What is the Purpose of System.Collections.Generic ?
For more safty and better performance strongly typed collections are useful for the user. System.Collections.Generic having interfaces and classes which define strongly typed generic collections.Reply
What is the use of Global.asax File in ASP.NET Application ?
The Global.asax file, can be stored in root directory and accesible for web-sites,is an optional file.This Global.asax file contained in HttpApplicationClass.we can declare global variables like variables used in master pages because these variables can be used for different pages right.Importent feature is that its provides more security in comparision to other.
It handle two event:
Global.asax File itself configured but it can not be accessed.while one request is in processing it is impossible to send another request, we can not get response for other request and even we can not start a new session.
while adding this Global.asax file to our application by default it contains five methods,
Those methods are:
What is the Default Expiration Period For Session and Cookies,and maximum size of viewstate?
The default Expiration Period for Session is 20 minutes.
The default Expiration Period for Cookie is 30 minutes.
The maximum size of the viewstate is 25% of the page sizeReply
Difference between Session object and Profile object in ASP.NET?
1. Profile object is persistent.
2. Its uses the provider model to store information.
3. Strongly typed
4. Anonymous users used mostly.
1. Session object is non-persistant.
2. Session object uses the In Proc, Out Of Process or SQL Server Mode to store information.
3. Not strongly typed.
4. Only allowed for authenticated users.Reply
What are the two levels of variable supported by Asp.net?
1. Page level variable:String ,int ,float.
2. Object level variable:Session level, Application level.Reply
Explain the aim of using EnableViewState property?
When the page is posted back to the server, the server control is recreated with the state stored in viewstate.It allows the page to save the users input on a form across postbacks. It saves all the server side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. Reply
Why the exception handling is important for an application?
Exception handling prevents the unusual error in the asp.net application,when apllication executed.If the exceptions are handled properly, the application will never get terminated abruptly.Reply
Define Error Events in Asp.Net?
In ASP.Net when any unhandled exception accurs in application then an event occures,that event called Error event.Two types of Event:
1. Page_Error:When exception occures in a page then this event raised.
2. Application_error:Application_Error event raised when unhandled exceptions in the ASP.NET application and is implemented in global.asax.
The error event have two method:
1. GetLastError: Returns the last exception that occurred on the server.
2. ClearError: This method clear error and thus stop the error to trigger subsequent error event.
How to create Multivalued Cookie ?
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
void btnSubmit_Click(Object s, EventArgs e)
Response.Cookies["preferences"]["firstName"] = txtFirstName.Text;
Response.Cookies["preferences"]["lastName"] = txtLastName.Text;
Response.Cookies["preferences"]["favoriteColor"] = txtFavoriteColor.Text;
Response.Cookies["preferences"].Expires = DateTime.MaxValue;
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Set Cookie Values</title>
<form id="form1" runat="server">
<br /><br />
<br /><br />
<br /><br />
How do you require authentication using the Web.config file?
Include the following <authorization> element to require authentication:
<deny users="?" />