Asp.net Interview questions and answers
Asp.net Interview questions and answers
- 1. Does Main() always have to be public?
--> No.
- 2.How do you turn off SessionState in the web.config file?
--> just simply put following code to disable SessionState.
<httpModules>
<remove name=”Session” />
</httpModules>
- 3. short-circuited operators:
In C#, "&" and "|" operators evaluate both boolean expressions in the statement.
However, the "&&" operator only evaluates the first Boolean if false ,and the "||" operator only evaluates the first Boolean if true.
This technique prevents the execution of the second expression if unnecessary.
So,To achieve performance in your application.
//Don't use this:
if (_username ==”” & _password == “”)
{
…
}
//Make a practice of this in your whole application:
if (_username == “” && _password == “”)
{
…
}
controller to controller.
---> ViewData & ViewBag are used when want to pass data from controller to view.
---> Hidden fields , query string are used when want to pass data from view to controller.
C------->C = TempData
C------->V = ViewData,ViewBag
V------->C = HiddenFields,query strings
- 4. Use of TempData, (ViewData , ViewBag), Hiddenfield and query string.
controller to controller.
---> ViewData & ViewBag are used when want to pass data from controller to view.
---> Hidden fields , query string are used when want to pass data from view to controller.
C------->C = TempData
C------->V = ViewData,ViewBag
V------->C = HiddenFields,query strings
Comments
Post a Comment