ASP.NET Interview Questions and answers for Experienced

Question.1  What is IIS? Why is it used?

Answer:   Internet Information Services (IIS) is created by Microsoft to provide Internet-based services to ASP.NET Web applications. It makes your computer to work as a Web server and provides the functionality to develop and deploy Web applications on the server. IIS handles the request and response cycle on the Web server. It also offers the services of SMTP and FrontPage server extensions. The SMTP is used to send emails and use FrontPage server extensions to get the dynamic features of IIS, such as form handler.

Question.2   What is Query String? What are its advantages and limitations?

Answer:   The Query String helps in sending the page information to the server.
The Query String has the following advantages:

  • Every browser works with Query Strings.
  • It does not require server resources and so does not exert any kind of burden on the server.

The following are the limitations of Query String:

  • Information must be within the limit because URL does not support many characters.
  • Information is clearly visible to the user, which leads to security threats.[sociallocker]

Question.3   What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?

Answer:   When a browser requests an .aspx file then the server returns a response, which is rendered into a HTML string.

Question.4   How can you display all validation messages in one control?

Answer:   The ValidationSummary control displays all validation messages in one control.

Question.5   Which two new properties are added in ASP.NET 4.0 Page class?

Answer:   The two new properties added in the Page class are MetaKeyword and MetaDescription.

Question.6   What is tracing? Where is it used?

Answer:   Tracing displays the details about how the code was executed. It refers to collecting information about the application while it is running. Tracing information can help you to troubleshoot an application. It enables you to record information in various log files about the errors that might occur at run time. You can analyze these log files to find the cause of the errors.
The System.Diagnostics namespace contains the predefined interfaces, classes, and structures that are used for tracing. It supplies two classes, Trace and Debug, which allow you to write errors and logs related to the application execution. Trace listeners are objects that collect the output of tracing processes.

Question.7   What is the difference between authentication and authorization?

Answer:   Authentication verifies the identity of a user and authorization is a process where you can check whether or not the identity has access rights to the system. In other words, you can say that authentication is a procedure of getting some credentials from the users and verify the user’s identity against those credentials. Authorization is a procedure of granting access of particular resources to an authenticated user. You should note that authentication always takes place before authorization.

Question.8   How can you register a custom server control to a Web page?

Answer:   You can register a custom server control to a Web page using the @Register directive.

Question.9   Which ASP.NET objects encapsulate the state of the client and the browser?

Answer:   The Session object encapsulates the state of the client and browser.

Question.10   Differentiate globalization and localization.

Answer:   The globalization is a technique to identify the specific part of a Web application that is different for different languages and make separate that portion from the core of the Web application. The localization is a procedure of configuring a Web application to be supported for a specific language or locale.

Question.11   What is ViewState?

Answer:   The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.

Question.12   Which method is used to force all the validation controls to run?

Answer:   The Page.Validate() method is used to force all the validation controls to run and to perform validation.

Question.13   Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?

Answer:    The RedirectPermanent() method added in ASP.NET 4.0 to redirect a page permanently. The following code snippet is an example of the RedirectPermanent() method:  RedirectPermanent(“/path/Aboutus.aspx”);

Question.14   How can you send an email message from an ASP.NET Web page?

Answer:  You can use the   System.Net.Mail.MailMessage  and the System.Net.Mail.SmtpMail classes to send an email in your Web pages. In order to send an email through your mail server, you need to create an object of the SmtpClient class and set the server name, port, and credentials.

Question.15  What is the difference between the Response.Write() and Response.Output.Write() methods?

Answer:   The Response.Write() method allows you to write the normal output; whereas, theResponse.Output.Write() method allows you to write the formatted output.

Question.16   What does the Orientation property do in a Menu control?

Answer:  Orientation property of the Menu control sets the horizontal or vertical display of a menu on a Web page. By default, the orientation is vertical.

Question.17   Differentiate between client-side and server-side validations in Web pages?

Answer:   Client-side validations take place at the client end with the help of JavaScript and VBScript before the Web page is sent to the server. On the other hand, server-side validations take place at the server end.

Question.18   How does a content page differ from a master page?

Answer:   A content page does not have complete HTML source code; whereas a master page has complete HTML source code inside its source file.

Question.19   Suppose you want an ASP.NET function (client side) executed on the MouseOver event of a button. Where do you add an event handler?

Answer:   The event handler is added to the Add() method of the Attributes property.[/sociallocker]

Visit for ASP NET Training Online