Top 5 ASP.NET Interview Questions

ASP.NET Fundamentals covers basic topics of ASP.NET Framework such as Session, Cookie, HTTP Handler, HTTP Module, Forms Authentication, Caching, Exception Handling, ASP.NET Request Processing etc.


What is ASP.NET?

ASP.NET is a framework developed by Microsoft to build dynamic web applications. There are two programming models to develop web applications using ASP.NET.

  1. ASP.NET Web Forms

Both programming models use ASP.NET on the top of that.

ASP.NET is also a part of Microsoft's .NET Framework. We can write ASP.NET Applications code in any .NET Framework supported language i.e. C#, J#, F#, VB etc.

ASP.NET applications can only be hosted under IIS Server which is available on Window Operating Systems only.

Microsoft has now moved it's further development from this traditional .NET Framework (Windows only) to new .NET Core, which is Cross Platform (supporting Windows, MAC OS, and Linux) framework to develop software applications i.e. Desktop, Web, Console, Mobile Applications.


Sessions are basically server variables that are used to store information on Server.

Session in ASP.NET enables you to store information on server & access that stored information on your sub-sequent web-requests.

HTTP is a stateless protocol, it means every web-request is a new web-request in itself. It does not hold or preserve previous request data. So, Sessions provides us a way to identify the user from on the subsequent web requests.

How to set a value in session in C#:

 Session["Email"] = "";

How to retrieve the stored value from the session:

 string email = Convert.ToString(Session["Email"])

I have covered only basics. You should also study below advanced topics related to Session:

  • Session Identifier
  • Session State Modes


An HTTP Cookie is a piece of data that is stored on the user's browser. Whenever you make a web-request, all the cookies associated with the domain are sent with the web- request.

On the server, we can access those cookies & read values from them. Hence, cookies help us in maintaining state by storing data on client's machine.

You can add a cookie in ASP.NET in following way:

 Response.Cookies.Add(new HttpCookie("Email", ""));

To read the cookie, you can use below syntax:

string email = Convert.ToString(Request.Cookies["Email"]);


State Management is a technique in ASP.NET to maintain states. There are following ways in ASP.NET to maintain states:

Server Side

  1. Session
  2. Application

Client Side

  1. Cookies
  2. Query String
  3. View States
  4. Hidden Fields



Response.Redirect() is the most common way of redirecting a user from one web-page to another. For example, Whenever you write Response.Redirect("~/default.aspx") in the code, server sends the response to browser with 302 status code. It also sends the location where the browser needs to redirect the user in Location header in the response. So, whenever, the browser receives 302 status code, it looks for Location header in the response and redirects the user to that web page.


Server.Transfer() is the way of redirecting a user from the server. For example, if you write Server.Transfer("~/default.aspx") in code, the server will redirect user to default.aspx page & will display the response provided by default.aspx page.

Differences between Response.Redirect() and Server.Transfer()

  1. In Response.Redirect(), it's browser's responsibility to redirect the user to a web-page while in Server.Transfer() it is Server's responsibility.
  2. In Response.Redirect(), URL changes to the new one while in Server.Transfer() URL doesn't changes.
  3. Server.Transfer() is faster than Response.Redirect().