.Net Deck 5 Flashcards
How does one implement this? (Make sure only known users are allowed to execute code)
Add[Authorize] to your method signature or on top of the entire controller.
How does the web server know who you are across different web requests?
Through Cookies
Would this method work if you were to switch out browsers in the middle of a session?
No, they are browser specific
How would you declare an array in C#
string[] x = new string[2] // (the 2 creates an array of items)
What are Collections in .Net?
A container with multiple elements. For example, a list . Collections don’t necessarily have a key, but they do have an index.
What are Connection Strings?
A connection string is a string that specifies information about a data source and the means of connecting to it. It is passed in code to an underlying driver or provider in order to initiate the connection. Though commonly used for a database connection, the data source could also be a spreadsheet or text file.
The connection string may include attributes such as the name of the driver, server and database, as well as security information such as user name and password
What are the different parts of a Connection String?
User Id, Password, Database, Server
What are Nullable Types?
Having a Nullab;e type allows you to assign Null values to variables
How do you access the underlying value of a Nullable Type?
GetValueOrDefault()
Retrieves the value of the current Nullable object, or the default value of the underlying type.
When would you use a Nullable Type?
When you have a potential null parameter and you don’t want the default value of the value type, you just want null.