Asp.net interview questions and answers


share this interview article on:

Top  Asp.Net Interview Questions and Answers

The most common question for experience persons is

1) What is ASP.NET ?

It is a framework developed by Microsoft on which we can develop new generation web sites using web forms(aspx), MVC, HTML, Javascript, CSS etc.

  • 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)  In which event of page cycle is the ViewState available?

After the Init() and before the Page_Load().

3)  What is the difference between Server.Transfer and Response.Redirect? 

In Server.Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser.  This provides a faster response with a little less overhead on the server.  The clients url history list or current url Server does not update in case of Server.Transfer.

Response.Redirect is used to redirect the user’s browser to another page or site.  It performs trip back to the client where the client’s browser is redirected to the new page.  The user’s browser history list is updated to reflect the new address.

4)  What are the different validators in ASP.NET?

 

  1. Required field Validator
  2. Range  Validator
  3. Compare Validator
  4. Custom Validator
  5. Regular expression Validator
  6. Summary Validator
5)  Which validator control you use if you need to make sure the values in two different controls matched?

Compare Validator control.

6)  What is ViewState?

ViewState is used to retain the state of server-side objects between page post backs.

7) Where the viewstate is stored after the page postback?

ViewState is stored in a hidden field on the page at client side.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.

8) How long the items in ViewState exists?

They exist for the life of the current page.

9) Describe state management in ASP.NET ?

State management is a technique to manage a state of an object on different request.

The HTTP protocol is the fundamental protocol of the World Wide Web. HTTP is a stateless protocol means every request is from new user with respect to web server. HTTP protocol does not provide you with any method of determining whether any two requests are made by the same person.

Maintaining state is important in any web application. There are two types of state management system in ASP.NET.

- Client-side state management
- Server-side state management

10) Explain client side state management system ?

ASP.NET provides several techniques for storing state information on the client. These include the following:

view state: ASP.NET uses view state to track values in controls between page requests. It works within the page only. You cannot use view state value in next page.

control state: You can persist information about a control that is not part of the view state. If view state is disabled for a control or the page, the control state will still work.

hidden fields: It stores data without displaying that control and data to the user’s browser. This data is presented back to the server and is available when the form is processed. Hidden fields data is available within the page only (page-scoped data).

Cookies: Cookies are small piece of information that server creates on the browser. Cookies store a value in the user’s browser that the browser sends with every page request to the web server.

Query strings: In query strings, values are stored at the end of the URL. These values are visible to the user through his or her browser’s address bar. Query strings are not secure. You should not send secret information through the query string.

11) Explain server side state management system ?

Application State:
This object stores the data that is accessible to all pages in a given Web application. The Application object contains global variables for your ASP.NET application.

Cache Object: 
Caching is the process of storing data that is used frequently by the user. Caching increases your application’s performance, scalability, and availability. You can catch the data on the server or client.

Session State: 
Session object stores user-specific data between individual requests. This object is same as application object but it stores the data about particular user.



Related Interview Questions

ADS

Tags:

asp.net, session, view state, state management, page life cycle, validation, hidden fields, cookies,