logo

,

Top 10 Asp.net interview questions (Web Forms)

1) What is Asp.net?

Asp.net is a server side technology used for developing web applications. It was released in 2002 and has an .aspx extension to its pages.

 

2) What is the difference between client side and server side validation in Asp.net?

Client side validation works on the client end(on the client’s browser in case of asp.net) with the help of JavaScript or jQuery. In client side validation the request is processed on the client machine, hence reducing the burden on the server.
Server side validation works at server end. The validation logic is written in either c#, vb or f#. In server side validation the request is processed on the server side.

 

3) What are the different types of Validation Controls in Asp.net?

RequiredFieldValidator – Makes the textbox control a required field
CompareValidator – Compare the value of one textbox control to the value of another textbox control
RangeValidator – Checks that the user enters a value that falls between two values
RegularExpressionValidator – Ensures that the value of the textbox control matches a specified pattern
CustomValidator – Allows you to write custom method to handle the validation of the value entered
ValidationSummary – Displays a summary of all validation errors occurred on the web page.

 

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

Response.Redirect can be used to redirect user to any page within our web application or to any page which is not part of our web application.
Server.Transfer can only be used to redirect or transfer user within our web application.

 
//This will work. 
Response.Redirect("http://www.google.com"); 

//This will not work. 
Server.Transfer("http://www.google.com"); 

 

5) What is State Management in Asp.net?

State Management is implemented in order to retain information about the user requests. Web pages are stateless in nature and each request creates a new page instance without retaining any previous information about the user request.
There are two types of State management in ASP net. They are :
1. Server-side
2. Client-side

These are further subdivided into the following –

1. Server-Side

a. Session
b. Application
c. Cache

2. Client-Side

a. Cookies
b. Viewstate
c. Control state
d. Query String
e. Hidden Field

 

6) What is Session in Asp.net?

Session is a server side state management technique and hence stores the information on the server. Information from a Session variable is accessible across all web pages with in an Asp.net web application.  Session state is usually cleared after a period of inactivity from the user.

 

7) What is Viewstate in Asp.net?

Viewstate is a client side state management technique. Viewstate is stored in a hidden field on the client’s browser and is specific to a page. Information from a Viewstate can only be accessible on a specific page (i.e. on the page the Viewstate was created). Viewstate doesn’t have an expiration date, it is available until the browser is open.

 

8) What is the maximum size of a cookie?

4kb

 

9) What is default Session timeout in Asp.net?

20 minutes is the idle default Session timeout. This default timeout value is configurable i.e. can be changed by the programmer.

 

10) What is the use of isPostBack property?

The “IsPostBack” property of page object is used to check that the page is posted back or not.

Share on facebook
Share on twitter
Share on linkedin

Related articles