Microsoft ASP.NET Interview Questions with Answers

Microsoft ASP.NET Interview Questions with Answers

ASP.NET is a server side technology to create dynamic web applications. It was developed by Microsoft. ASP.NET introduced in January 2002. ASP.NET is a part of MS.NET framework. Are you a MS.NET Professional seeking for a better Job. Prepare the below ASP.NET Interview Questions well before your interview.

What is the difference between Classic ASP & ASP.NET?

Classic ASP is the lower version of ASP.NET. ASP.NET comes with MS.NET Framework. ASP is running under the inetinfo.exe (IIS) when ASP.NET distinct work process using aspnet_wp.exe. It is separate from inetinfo.exe. Classic ASP is not compiled for Apache web server. Using ASP.NET we can execute our app with Apache web server. ASP.NET provides more better performance based application then ASP. The compiling process for ASP & ASP.NET is different. ASP.NET introduced with Common Language Run-time, MSIL, JIT & CLR. The time we are writing code in ASP.NET it get compiled to a byte code format like Java. Due to byte code execution get faster in ASP.NET compare to Classic ASP. ASP.NET introduced code behind concept. Compare to Classic ASP we can write more structured codes in ASP.NET.

What are the different types of validation provided by ASP.NET?

Using validation we protects unnecessary page submissions. Few most common used validations provided by ASP.NET is listed below.

CompareValidator – Compare validation compares values of two input controls.
CustomValidator – Allow programmer to write own validation scripts.
RangeValidator – Checks the user value with in a Specific range.
RegularExpressionValidator – Ensures that the value of an input control matches a specified pattern.
RequiredFieldValidator – Make the control input Mandatory.
ValidationSummary – Displays a report of all validation errors occurred in a Web page.

What are the types of Authentication in ASP.NET?

ASP.NET provides 3 types of Authentications as listed in below.

Windows Authentication
Form Authentication
Passport Authentication

What is view state?

Let assume we have a form with more then ten input controls. I filled out the form and submitted to the server. Assume the form is designed using classic ASP & in between the page submission internet get disconnected. In this situation using back button if I will back to the form then there is no data persist in the input controls. This is a drawback to dynamic web applications. To resolve this view state concept introduced in ASP.NET. View state is responsible to keep state of web controls during page submission. By default view state is enabled in ASP.NET. In back-end view state creates hidden HTML input control to store web control data in encrypted format. With state less HTML view state helps to protect data from Accidental Submission.

What are the state management technique implemented by ASP.NET?

There are 2 types of State management techniques found in ASP.NET. Server Side & Client Side. Server side state management techniques are Session & Application. Client side state management techniques are Hidden Field, View State, Cookie, Control State & Query String.

Explain me the use of Global.asax

Global.asax is a file locating at the root folder of ASP.NET applications. Global.asax provide a way to Application or Module level events in one Central location. Global.asax file derived from HttpApplication class. Default events found in Global.asax are Application_Start, Application_End, Application_Error, Session_Start, Session_End.

What is postback in ASP.NET?

Postback is a technical term to page Submission. Using isPostback event we can check postback happened or not. isPostback returns boolean value.

What are the advantages of code-behind feature?

Code-behind allow programmers to separate business logic & User Interface. Its a new technique introduced by ASP.NET.

What is the difference between user control & custom control?

User Controls can be used for reusable purpose. Custom Control can be used for Global toolbox Control. User control is accessible for current project. When Custom Control can be used Globally. The Extension of user control is .ascx. Extension for Custom Control is .dll. User Control can visible in Solution Explorer when Custom Control is visible in toolbox. Using register tag we can embed an user control but Custom Control used like a normal Control.

What is the use of app_code folder in ASP.NET?

App_Code folder stores Classes, typed data sets etc. If we store any Classes in App_Code it compiles automatically.

What do you mean by multilingual website?

Websites are rotating globally. Let talk about a website Here we are getting ten thousand visitors in each day from many angle of world map. When a US customer is watching he/she prefer to look the language English. But the time we have a Customer from France he/she prefer to look in french. Here the concept multilingual comes into. In simple multilingual websites can display the content in various global languages.

How to display all validation errors in one control?

ASP.NET provides five validation controls with ValidationSummary. Using ValidationSummary we can display all validation errors in our ASP.NET page.

What is query string?

Query String is a technique to transfer values from one page to an other web page. Generally query strings are not secured. It will visible at address bar. To write a Query String we can use the following line of code. For more then one query string with the same url we can use &. massage&SecondQueryString=sample

How to send email using ASP.NET?

By default ASP.NET provides SMTP mail server. Using few lines of code we can send an email in ASP.NET. Find the script below.

MailMessage mailMessage = new MailMessage();
mailMessage.To.Add("[email protected]");
mailMessage.From = new MailAddress("[email protected]");
mailMessage.Subject = "test mail";
mailMessage.Body = "Hello world,\n\nThis is a test mail e-mail!";
SmtpClient smtpClient = new SmtpClient("");
Response.Write("Mail Sent Successfully.");