ASP.NET Interview Questions & Answers

1. Explain the life cycle of an ASP .NET page.?
6)Control Events

2.what is ispostback in
IsPostBack is used to check that a page is submitted to server or first time rendering. if you write the code in a block
If Not isPostBack()
'''''code here
End if
this code will execute only once when this page runs first time. on any other submit event this page will be submitted to server but this block will not execute.

3.what is boxing and unboxing?
Converting a value type to reference type is called Boxing. Unboxing is the opposite operation and is an explicit operation.
int Val = 1;
Object Obj = Val; //Boxing
int i = (int)Obj; //Unboxing

4.What is the use of AutoEventWireup in
AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not.
In the case where AutoEventWireup attribute is set to false (by default) event handlers are automatically required for Page_Load or Page_Init. However when we set the value of the AutoEventWireup attribute to true the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init.

5.what events will occur when a page is loaded?
1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad

6.Where do the Cookie State and Session State information be stored?
Cookie Information will be stored in a txt file on client system under a
folder named Cookies. Search for it in your system you will find it.
Coming to Session State
As we know for every process some default space will be allocated by OS.
In case of InProc Session Info will be stored inside the process where our
application is running.
In case of StateServer Session Info will be stored using ASP.NET State Service.
In case of SQLServer Session info will be stored inside Database. Default DB
which will be created after running InstallSQLState Script is ASPState.

7.What are the different types of sessions in ASP.Net? Name them.?
Session Management can be achieved in two ways

OutProc is again two types
1)State Server
2)SQL Server

8.What is caching? What are different ways of caching in ASP.NET?
Caching is a technique of persisting the data in memory for immediate access to requesting program calls. This is considered as the best way to enhance the performance of the application.

Caching is of 3 types:
Output Caching - Caches the whole page.
Fragment Caching - Caches a part of the page
Data Caching - Caches the data


Post a Comment

Design by Abhinav Ranjan Sinha