ASP.NET interview questions and answers

Question.1   What is ASP?

Answer:   Active Server Pages (ASP), also known as Classic ASP, is a Microsoft’s server-side technology, which helps in creating dynamic and user-friendly Web pages. It uses different scripting languages to create dynamic Web pages, which can be run on any type of browser. The Web pages are built by using either VBScript or JavaScript and these Web pages have access to the same services as Windows application, including ADO (ActiveX Data Objects) for database access, SMTP (Simple Mail Transfer Protocol) for e-mail, and the entire COM (Component Object Model) structure used in the Windows environment. ASP is implemented through a dynamic-link library (asp.dll) that is called by the IIS server when a Web page is requested from the server.

Question.2   What is ASP.NET?

Answer:   ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of .NET Framework. You can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages, such as VBScript. The Web Forms support to create powerful forms-based Web pages. You can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls, you can easily create a Web application. 

Question.3   What is the basic difference between ASP and ASP.NET?

Answer:   The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language (MSIL).

Question.4   In which event are the controls fully loaded?

Answer:    Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event.

Question.5   How can we identify that the Page is Post Back?

Answer:   Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.

Question.6   What is the lifespan for items stored in ViewState?

Answer:   The items stored in ViewState live until the lifetime of the current page expires including the postbacks to the same page.

Question.7   How information about the user’s locale can be accessed?

Answer:   The information regarding a user’s locale can be accessed by using the System.Web.UI.Page.Cultureproperty.

Question.8   What is the difference between SQL notification and SQL invalidation?

Answer:  The SQL cache notification generates notifications when the data of a database changes, on which your cache item depends. The SQL cache invalidation makes a cached item invalid when the data stored in a SQL server database changes.

Question.9   Which is the parent class of the Web server control?

Answer:   The System.Web.UI.Control class is the parent class for all Web server controls.

Question.10 Can you set which type of comparison you want to perform by the CompareValidator control?

Answer:  Yes, by setting the Operator property of the CompareValidator control.

Question.11   What is the behavior of a Web browser when it receives an invalid element?

Answer:  The behavior of a Web browser when it receives an invalid element depends on the browser that you use to browse your application. Most of the browsers ignore the invalid element; whereas, some of them display the invalid elements on the page.

Question.12  Can a custom .NET data type be used in a Web form?

Answer:   This can be achieved by placing the DLL containing the custom data type in the application root’s bin directory and ASP.NET will automatically load the DLL when the type is referenced

Question.13 How do you sign out from forms authentication?

Answer:  The FormsAuthentication.Signout() method is used to sign out from the forms authentication.

Question.14  What is AutoPostBack?

Answer:  If you want a control to postback automatically when an event is raised, you need to set the AutoPostBackproperty of the control to True.

Question.15   What is the function of the ViewState property?

Answer:  The ASP.NET 4.0 introduced a new property called ViewStateMode for the Control class. Now you can enable the view state to an individual control even if the view state for an ASP.NET page is disabled.

Question.16    Why do you use the App_Code folder in ASP.NET?

Answer:   The App_Code folder is automatically present in the project. It stores the files, such as classes, typed data set, text files, and reports. If this folder is not available in the application, you can add this folder. One of the important features of the App_Code folder is that only one dll is created for the complete folder, irrespective of how many files it contains.

Question.17   Define a multilingual Web site.

Answer:  A multilingual Web site serves content in a number of languages. It contains multiple copies for its content and other resources, such as date and time, in different languages.

Question.18   What is an ASP.NET Web Form?

Answer:   ASP.NET Web forms are designed to use controls and features that are almost as powerful as the ones used with Windows forms, and so they are called as Web forms. The Web form uses a server-side object model that allows you to create functional controls, which are executed on the server and are rendered as HTML on the client. The attribute, runat=”server”, associated with a server control indicates that the Web form must be processed on the server.

Question.19   What is the difference between a default skin and a named skin?

Answer:   The default skin is applied to all the Web server controls in a Web form, which are of similar type, and it does not provide a Skin ID attribute. The named skin provides a Skin ID attribute and users have to set the Skin ID property to apply it.

ASP NET e-learning By 10+ Year Expert Trainer