Top ASP.NET Interview Questions Part 1
1.What is ASP.Net?
- It is an inheritor of Microsoft Active Server Pages(ASP).
- Current version of ASP.NET 4.6.
- ASP.NET applications can be created in most of the .NET compatible languages, such as Visual Basic, C#, and J#.
- It compiles the Web pages and provides better performance.
- The ASP.NET Web server controls create interactive Web applications.
- ASP.NET works on top of the HTTP protocol.
2.What is the basic difference between ASP and ASP.NET?
|1||ASP is interpreted.||ASP.NET is compiled.|
|2||ASP uses VBScript or JScript.||ASP.NET uses .NET languages,
such as C# and VB.NET,
which are compiled to Microsoft
Intermediate Language (MSIL).
|3||It has partial OOPS support and
not having built in support for xml.
|ASP.NET is full featured object oriented programming.|
|4||Error handling is very poor.||Error handling is highly perfect.|
|5||It has no in built validation control.||It has rich validation set - custom validator, range validator, regular expression, compare and require field validation control which makes your job easier.|
3.How can we identify that the Page is Post Back?
The "IsPostBack" boolean property is checked to know the status of page postback.
4.What is the lifespan for items stored in ViewState?
The items stored in ViewState live until the lifetime of the current page expires including the postbacks to the same page.
5.Detail the Life cycle of events in ASP.NET?
To track events turn on <% @Page Trace=”true”%> in web.config to follow the below events:
-Represents the entry point of the page life cycle.
-Dynamic controls are created in this event.
-Each and every control is initialized here.
-Page is initialized and the initialization process is completed.
-This event is called before the loading of the page is completed.
-LoadViewState event allows loading view state information into the controls.
-During this phase, the contents of all the input fields are defined with the <form> tag are processed.
-This event is raised for the Page and then all child controls.
-The controls properties and view state can be accessed at this stage.
-This event indicates that the controls have been fully loaded.
-This event signals indicates that the page has been loaded in the memory.
-It also marks the beginning of the rendering stage.
-This event allows to perform final updates to the controls or the page.
-It first fires for the page and then for all the controls.
-Is called to explicitly state that the PreRender phase is completed.
-In this event, the current state of the control is completely saved to the ViewState.
-This event is typically used for closing files and database connections.
-At times, it is also used for logging some wrap up tasks.
6.How information about the user's locale can be accessed?
It can be accessed by using the System.Web.UI.Page.Culture property.
7.What is the difference between SQL notification and SQL invalidation?
|SQL notification||SQL invalidation|
|It generates notifications when the data
of a database changes, on which
your cache item depends.
|It makes a cached item invalid when the data stored in a SQL server database changes.|
8.Which is the parent class of the Web server control?
The System.Web.UI.Control class is the parent class for all Web server controls.
9.What is the behavior of a Web browser when it receives an invalid element?
It depends on the browser. Most of the browsers ignore the invalid element.
10.Can you set which type of comparison you want to perform by the CompareValidator control?
It can be done by setting Operator property of the CompareValidator control.