ASP.Net Interview Questions and Answers

    16 Votes

77) Where is ViewState information stored ?
Viewstate information is always stored in HTML hidden fields.

78) What is the significance of Finalize method in .NET?

.NET Garbage collector does almost all clean up activity for your objects. But unmanaged resources (ex: - Windows API Database connection objects, File, created objects, COM objects etc) is outside the scope of .NET framework we have to explicitly clean our resources. For these types of objects, .NET framework will provide Object.Finalize method which will be overridden and clean up code for unmanaged resources can be put in this section.

79) What are the best ways to send data across pages in ASP.NET?
Below are the two ways used to send data across pages in ASP.NET –
  • Public properties
  • Session
80) What are Web Part controls in ASP.NET?

Web part controls are integrated controls which are used to create a website. This allows the user to change the outlook, content and state of the pages in browser.

81) What is the use of Global.asax ? and explain the events in Global.asax ?

It allows to executing ASP.NET application level events and setting application-level variables.

  • Application_Init
  • Application_Disposed
  • Application_Error
  • Application_Start
  • Application_End
  • Application_BeginRequest
  • Application_EndRequest
  • Application_PreRequestHandlerExecute
  • Application_PostRequestHandlerExecute
  • Applcation_PreSendRequestHeaders
  • Application_PreSendContent
  • Application_AuthenticateRequest
  • Application_AuthorizeRequest
  • Session_Start
  • Session_End

82) How we can copy items of one dropdownlist to another dropdownlist control?

Foreach ( var listitem in firstdropdownlist.Items)
{
seconddropdownlist.Items.Add(listitem);
}

In the above code we are getting all the items from first dropdownlist and then add it to the item list of second dropdownlist.

83) What’s the difference between Literal control and Label control?

Label control mark up is given below –

<asp:Label ID = "Label1" Text="Label Test" runat="server" />
  • Label control is rendered as <span> when rendered as HTML. Label control styles like font size, font color etc can be changed with very less effort. Javascript or JQuery also can access the label control very easily.
  • Literal control rendered as it is. Literal control cannot be styled easily like label control because it does not render in enclosed HTML tags. Javascript or Jquery will not be able to access literal control because while rendering it would not have ID in spite of giving the ID in mark up.

84) Explain the components of web form in ASP.NET?

Server controls - The server controls are Hypertext Markup Language (HTML) elements that include a runat=server attribute. These controls provide automatic state management and server-side events and respond to the user events by executing event handler on the server.

  • HTML controls - These controls also respond to the user events but the events processing happen on the client machine.
  • Data controls - Data controls allows us to connect to the database, execute command and retrieve data from database.

85) Which are the different IIS isolation levels in ASP.NET?

IIS has three level of isolation –

  • LOW (IIS process) - In this, ASP.NET application and main IIS process run in same process. So, if any application crashes it will adversely affect the others too.
  • Medium (Pooled) - In Medium pooled scenario the IIS and web application run in different process. So in this case there will be two processes process1 and process2. Process1 runs the IIS process and Process2 runs the Web application.
  • High (Isolated) - Here every process runs under it’s own process. This consumes heavy memory but has highest reliability.

86) What is Virtual folder?

It is the physical folder that contains web applications. This folder is used by IIS for web application deployment.

87) Why to use “CustomErrors” section in config?

CustomError tag gives the details of custom error messages. CustomError tag can be defined at any level in application file hierarchy.

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="A4academicsError.html"/>
</system.web>
</configuration>

As you can see above customError section has attribute - "defaultRedirect", which specifies the default redirection.

88) How to open a page in a new window?

To open a page in a new window, we have to use client script using onclick="window.open()" attribute of mainly HTML control.

89) What exactly happens when ASPX page is requested from Browser?

Following are the steps which will occur when we request an ASPX page from web server –

  • The browser sends the request to the webserver. Let’s assume the webserver at the other end is IIS.
  • Once IIS receives the request, it looks for engine where it can serve this request. When engine means it’s the DLL which can parse this page or compile and send a response back to browser. The request which is to be mapped is decided by file extension of the page requested.

Some File extension mapping given below -

  • .aspx, for ASP.NET Web pages,
  • .asmx, for ASP.NET Web services,
  • .config, for ASP.NET configuration files,
  • .ashx, for custom ASP.NET HTTP handlers,
  • .rem, for remoting resources

90) What is the sequence of methods called during page load?

  • Init() – This method will be used to Initialize the page.
  • Load() – This method loads the page in server memory.
  • PreRender() – This method is before page loaded to the user.
  • Unload() – This method runs once loading of the page finished.
Page 6 of 10

Popular Videos

communication

How to improve your Interview, Salary Negotiation, Communication & Presentation Skills.

Got a tip or Question?
Let us know

Related Articles

C# Interview Questions
.Net Framework Interview Questions and Answers
ADO.Net Interview Questions and Answers for Freshers, Experienced
ASP.Net MVC Interview questions and Answers
WCF Interview Questions and Answers
ASP.Net Web API Interview Questions
Top 50 Entity framework interview questions & answers