ASP.Net Interview Questions and Answers

    16 Votes

Frequently asked ASP.Net interview Questions and answers for freshers and 2-4 year experienced programmers on basic and advanced topics.

1) What is ASP.NET ?

  • ASP.NET is a Server-Side technology which uses object-oriented programming approach. Every element in ASP.NET is treated as an object and run on the server. 
  • ASP.NET allows you to use a fully featured programming language like C-Sharp (C#) or VB.NET to build web applications easily. 
2) What is Common Language Runtime or CLR ?

CLR handles the compilation and execution of .NET programs. CLR uses JIT and compiles the IL code to machine code and then executes. Below are the list of responsibilities of Common Language Runtime -

  • Garbage Collection
  • Code Verification
  • Code Access Security
  • Intermediate language -to-native translators and optimizer’s
3) What are Assemblies and Namespaces and explain the difference between them ?
Namespaces are the containers for holding the classes. In Object Oriented world, it is possible that programmers will use the same class name. By using namespace along with class name this collision can be removed.
  • An assembly exists as a .DLL or .EXE that contains MSIL code that is executed by CLR.
  • An assembly contains interface and classes and it can also contain other resources like files, bitmaps etc.
4) Describe the Events in the Life Cycle of a Web Application ?

A web application starts, when a browser requests a page of the application for the first time. The request will be received by the IIS which then starts ASP.NET worker process. The worker process then allocates a process space to the assembly and loads it. An Application_Start() event will fire on start of the application and it’s followed by Session_Start(). ASP.NET engine then processes the request and sends back response in the form of HTML to the user and user receives the response in the form of page.

5) Explain the application event handlers in ASP.NET ?

Below are the event handlers in sequence of their execution -

  • Application_Start - Fired when the first user visits a page of the application or first resource is requested from the server.
  • Application_End - Fired when there are no more users of the application.
  • Application_BeginRequest - Fired at the beginning of each request to the server.
  • Application_EndRequest - Fired at the end of each request to the server.
  • Session_Start - Fired when any new user visits.
  • Session_End - Fired when the users stop requesting pages and their session times out.

6) What are the Web Form Events available in ASP.NET ?

Following are the Web Form Events in the sequence of their execution -

  • Page_Init
  • Page_Load
  • Page_PreRender
  • Page_Unload
  • Page_Disposed
  • Page_Error
  • Page_AbortTransaction
  • Page_CommitTransaction 
  • Page_DataBinding

7) What is Global Assembly Cache ?

GAC (Global Assembly Cache) is used to share .NET assemblies. GAC will be used in the below scenarios –

  • If the multiple application wanted to use the same assembly.
  • If the assembly has security requirements. For example, if only administrators have the permission to remove the assembly.

8) Explain the Server Control Events of ASP.NET ?

ASP.NET offers many server controls like Textbox, Button Dropdown List etc. Each control will respond to the user’s actions using events and event handler mechanism. Following are the Server Control Events:

  • Postback events - These events sends the web page to the server for processing. Once processing is finished, web page will send data back to the same page on the server.
  • Cached events - These events are processed when a postback event occurs.

9) What are Strong Names ?

Strong names are unique names for assemblies. Strong name is similar as GUID in COM components. When we want to deploy the assembly in GAC, then we need to give the strong name for the assemblies. Strong name helps GAC to differentiate between two versions.

10) Explain the steps to generate the strong name ?

Go to Visual Studio Command Prompt

Type – “sn.exe –k “D:\TestingStrongName.snk” in command prompt.

Once SNK file is generated, sign the project with this SNK file. Go to project properties and browse the SNK file generated and build the project.

11) What are the State Management options in ASP.NET ?

Client-side state management - This maintains information on the client’s machine using either of the following options –

  • Cookies - Cookie is a small sized text file on the client machine either in the client’s file system or memory of client browser session.
  • View State - Each page and control on the page has View State property. This allows automatic retention of page and control’s state between each trip to server.
  • Query string - Query strings can maintain limited state information. Data has been passed from one page to another with the URL, but you can send limited size of data with the URL.

Server-side state management - This mechanism retains state in the server. Below are the options to achieve it -

  • Application State - The data stored in the application object can be shared by all the sessions of the application.
  • Session State - Session State stores session-specific information and the information is visible within the session only.

12) Explain the garbage collection in .NET ?

Garbage collection is a CLR feature which automatically manages memory. CLR automatically releases objects when they are no longer used and referenced. Following methods are used for garbage collection –


13) What is Reflection in .NET?

Reflection is a mechanism through which types defined in the metadata of each module can be accessed. The System. Reflection namespace will have the classes required for reflection.

14) Define Resource Files?

Resource files contains non-executable data like strings, images etc. that can be used by an application and deployed along with it. You can change these data without recompiling the whole application.

15) What are different types of caching using cache object of ASP.NET?

We can use two types of output caching to cache information that is to be transmitted to and displayed in a Web browser –

  • Page Output Caching
  • Page Fragment Caching

16) How can you cache different version of same page using cache in ASP.NET?

Output cache functionality is achieved by using “OutputCache” attribute on ASP.NET page header. It uses following parameters –

  • VaryByParam - Caches different version depending on input parameters send through HTTP POST/GET.
  • VaryByHeader - Caches different version depending on the contents of the page header.
Page 1 of 10

Popular Videos


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