ASP.NET Interview Questions and Answers
1. What is ASP?
ANS: 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. 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.
2. What is ASP.NET?
ANS: 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 Vb Script.
3. When was ASP .Net was released?
ANS: ASP .Net was a part of the .NET framework which was released as a software platform in 2002.
4. What is the basic difference between ASP and ASP.NET?
ANS: The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses Vb Script; 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).
5. What is Authentication in ASP.NET?
ANS: The process of identifying a user through the use of an ID and a password is known as Authentication.
6. Authentication and authorization in ASP.NET?
ANS: Authentication is the process of verifying the identity of a user.
Authorization is process of checking whether the user has access rights to the system.
Authorization is the process of allowing an authenticated user access to resources.
Authentication always proceeds to Authorization.
7. What are ASP.Net authentication providers?
ANS: Windows Authentication Provider:
It is in conjunction with Microsoft Internet Information Services (IIS) authentication to secure ASP.NET applications
Forms Authentication Provider:
It is an application-specific login form which performs authentication using user code.
Passport Authentication provider:
It is a centralized authentication service provided by Microsoft that offers a single login and core profile service for member sites.
8. Describe how the ASP.NET authentication process works ?
ANS: ASP.NET runs inside the process of IIS due to which there are two authentication layers which exist in the system.
First authentication happens at the IIS level and the second at ASP.NET level per the WEB.CONFIG file.
9. Describe Paging in ASP.NET?
ANS: The Data Grid control in ASP.NET enables easy paging of the data. The Allow Paging property of the Data Grid can be set to True to perform paging. ASP.NET automatically performs paging and provides the hyperlinks to the other pages in different styles, based on the property that has been set for Pager Style.Mode.
10. What is ASP.NET Repeater Control?
ANS: The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control may be bound to a database table, an XML file, or another list of items.
11. What is impersonation in ASP.NET?
ANS: Impersonation is a technique to access application resources using the identity of some other user. By default, ASP.NET executes in the security context of a restricted user account on the local machine. ASP.NET can also impersonate a specific account you specify in web.config.
12. What are the different types of sessions in ASP.Net?
ANS: ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a “sticky-server” (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.
13. How do you validate the controls in an ASP .NET page?
ANS: Using special validation controls that are meant for this. We have Range Validator, Email Validator.
14. What is Fragment Caching in ASP.NET?
ANS: Fragment caching refers to the caching of individual user controls within a Web Form. Fragment caching allows to cache specific portions of the page rather than the whole page. It is done by implementing the page in different parts by creating everything in form of user controls and caching each user control individually.
15. Explain the life cycle of an ASP .NET Page?
ANS: Following are the events occur during ASP.NET Page Life Cycle:
6) Control Events
7) Page_Load Complete
Among above events Page_Render is the only event which is raised by page. So we can’t write code for this event.
16. How does the cookies work in asp.net?
ANS: There are two types of state management techniques:
a) Client side state management
b) Server – side state management
Using cookies comes under client side state management .In Http Response we write Cookie containing session Id and other information within it.
When a browser made a request to the web server the same cookie is sent to the server where server recognizes the session id and get other information stored to it previously.
17. What is Post back method in ASP.Net? Why do we use that?
ANS: Basically Post back is an action performed by a interactive Webpage. When it goes to the server side for a non-client Operation Server again posts it back to the client and hence the name.
If (! IsPostBack)
Will not allow the page to post back again n again bcoz it reduces the performance.
18. What is the use of Autoworker in asp.net?
ANS: AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not. In the case where AutoEventWireup attribute is set to false (by default) event handlers are automatically required for Page_Load or Page_Init. However when we set the value of the AutoEventWireup attribute to true the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init.
19. Why is ASP.NET is Better Then ASP:
ANS: ASP.NET is a much improved replacement for original ASP framework.
All ASP.NET code is fully compiled prior to execution.
ASP.NET doesn’t require the use of scripting languages
ASP.NET allows for total separation of code from HTML
ASP.NET state management works in a Web farm environment
20. What is a View State?
ANS: View state is used to maintain or retain values on post back. It helps in preserving a page. View state is internally maintained as a hidden field in encrypted form along with a key.
In ASP .NET, the View State of a form is maintained with a built-in state management technique keeps the state of the controls during subsequent post backs by a particular user.