Social Networks

Top 15 Interview questions with Answers

1. Can we make sessions do not use cookies?

We need to enable “cookieless” property in Web.config.

2. How can we force all the validation control to run?

Call Page.Validate

3. How can we check if all the validation control are valid and proper?

Using the Page.IsValid() property you can check whether all the validation are done.

4. If client side validation is enabled in your Web page, does that mean server side code is not run?

When client side validation is enabled server emit’s JavaScript code for the custom validators. But note that does not mean that server side checks on custom validators do not execute. It does this redundant check two times as some of the validators do not support client side scripting.

5. Which JavaScript file is referenced for validating the validators at the client side?

WebUIValidation.js javascript file installed at “aspnet_client” root IIS directory is used to validate the validation controls at the client side. That is true for .Net 1.1. in .Net 2.0 we use axd.file for that. You’ll have to save the AXD file, and then open it in notepad to see the actual javascript.

6. How to disable client side script in validators?

Set EnableClientScript property to false.

7. You find that one of your validation is very complicated and does not fit in any of the validators, what will you do ?

Best is to go for CustomValidators. Below is a sample code for a custom validator which checks that a textbox should not have zero value.


8. How can I show the entire validation error message in a message box on the client side?

In ValidationSummary control set property called “ShowMessageBox” to true.

9. What is Tracing in ASP.NET?

Tracing allows us to view how the code was executed in detail.

10. How do we enable tracing?

On the Application level we can add directive <trace enabled="true" to the web.config between … directives. On the page level we can add Trace =”true” to the @Page directive in the beginning of the page.


11. What exactly happens when ASPX page is requested from Browser?

  • The browser sends the request to the webserver. Let us assume that the webserver at the other end is IIS.
  • Once IIS receives the request he looks on which engine can serve this request. When I mean engine means the DLL who can parse this page or compile and send a response back to browser. Which request to map to is decided by file extension of the page requested. Depending on file extension following are some mapping: .aspx for ASP.NET Web pages, .asmx for ASP.NET Web services, .config for ASP.NET configuration files, .ashx for custom ASP.NET HTTP handlers, .rem for remoting resources etc.
  • Once IIS passes the request to ASP.NET engine page has to go through two section HTTP module section and HTTP handler section. Both these section have their own work to be done in order that the page is properly compiled and sent to the IIS.
    HTTP modules inspect the incoming request and depending on that they can change the internal workflow of the request. HTTP handler actually compiles the page and generates output. If you see your machine.config file you will see section of HTTP modules.
  • HTTP handler is where the actual compilation takes place and the output is generated. HTTP handler section is present in WEB.CONFIG file. Depending on the File extension handler decides which Namespace will generate the output. Example all .ASPX extension files will be compiled by System.Web.UI.PageHandlerFactory
  • Once the file is compiled it will be send back again to the HTTP modules and from there to IIS and then to the browser.


12. How can we kill a user session?

We can use Session.Abandon directive.


13. How do you upload a file in ASP.NET?

The code snippet given below enables you to upload a file to a folder named temp on your server:

string strdir = “D:\\temp\\”;
string strfilename = Path.GetFileName( txtFile.PostedFile.

Make sure to create the specified folder and change the path before attempting to execute the program. In the above code, you can the HTML File control so that users can browse for the required file. As you may know, an HTML control can be converted into an ASP.NET server control with the addition of the runat = “server” attribute. The system retrieves and saves the file using the PostedFile property. Because the HTML file control is used, you have to specifically give the enctype attribute of the Form tag:

Visual Studio 2005 ships with a built-in control named “FileUpload”. Hence, the usage of the HTML File control can be avoided. Also, there is no need to give the enctype attribute as shown above. The new control automatically handles the encryption.


14. How do I send email message from ASP.NET ?

To send an email from your ASP.NET page, you need to:

  • import the System.Web.Mail namespace in your ASP.NET page.
  • create an instance of the MailMessage class
  • set all the properties of the MailMessage instance.
  • send the message with SmtpMail.Send method.


15. What are different IIS isolation levels?

IIS has three level of isolation:

  • Low (IIS process) In this main IIS process and application run in same process. So if any one crashes the other is also affected. So all application and the IIS process runs on the same process. In case any website crashes it affects everyone.
  • Medium (Pooled) In Medium pooled scenario the IIS and web application run in different processes. So in this case there are two processes process1 and process2. In process1 the IIS process is running and in process2 we have all Web applications running.
  • High (Isolated) In high isolated scenario every process is running is their own process. This consumes heavy memory but has highest reliability.



None found.

Leave a Reply

Your email address will not be published. Required fields are marked *

Allowed Tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>