E-Learning 11th October 2019
Here is the list of top 20 ASP.NET Interview Questions and Answers:
Ans: ASP.NET is a .NET framework developed by Microsoft through which a programmer or developer can develop new generation website. It is the successor of Microsoft
Active Server Pages (ASP). There are several page extensions provided by Microsoft for using it in website development, such as : aspx, ashx, ascx, asmx, vb, cs, XML, html etc.
2. Difference between ASP.NET MVC and ASP.NET Web Forms?
Ans: ASP.NET Web Forms mainly use Page controller pattern for approaching rendering layout. In this case, every page has its own controller and code behind the file process the whole request. Whereas, the uses Front controller approach where a common controller is being used for all the pages to process the requests.
3. What is the Postback concept in ASP.NET?
Ans: Postback is a request which has been sent from client to server from the same page where user is already working. ASP.NET has been introduced to post an HTTP POST request mechanism back to the same page. It is mainly posting a complete page back to the server on the same page. Thus, the whole page has been refreshed.
4. What is the use of Response.Output.Write()?
5. What is the difference between Response.Redirect and Server.Transfer?
Ans: A programmer can write formatted output using Response.Output.Write().
6. Name the list of different validators in ASP.NET? Ans:
- Required Field Vaidator
- Compare Validator
- Range Validator
- Regular Expression Validator
- Custom Validator
- Summary Validator
7. Briefly explain the Page Life Cycle of ASP.NET?
Ans: Response.Redirect is mainly used to redirect the browser of the user to another site or another page. It performs trip back to the client where the client’s browser has been redirected to the new page. The browser history list of the user is updated to reflect the new address.
In Server.Transfer, page processing transfers from one page to another page on the website without making the roundtrip back to the client’s browser. It will ultimately provide a faster response with a little less overhead on the server. However, the URL history list or current URL server of the client does not update in such case.
Ans: During the life cycle, ASP. NET passes through a series of steps.
Initialization: In this stage, it controls their Init event. Variable and other objects are initializes for the complete lifecycle of request.
LoadViewState: It is a post backstage where it loads the view state of the controls to enable its view state property.
LoadPostBackData: It is a post back stage which loads the data that are being posted for the controls and then again update them.
Load: Page and all Controls raise their Load events in this stage. All the controls are initialized and loaded till this stage.
RaisePostBackEvent: It is raise against a button click event. Programmer can put code here to perform few activities.
8. Name the Base Class from which Web Forms are inherited?
SaveViewState: Controls State which is saved in this stage before rendering HTML.
9. What are the different Session State Management options in ASP.NET? Ans:
Render: Here, HTML is generated for the page.
11. What are the different types of Caching in ASP.NET? Ans:
Dispose: All objects associated with request.
Ans: Page Class
10. What is Caching?
Ans: It is a technique which is used to increase the performance by keeping the data or files in memory. The request of cached data/file will be accessed from cache instead of the actual location of that file.
12. Can we have a web application running without Web.Config file?
13. Which protocol is being used to call a web service?
14. Can we have multiple Web Config files for application of ASP.NET?
16. Can we add code file of different language in App_Code Folder?
Ans: HTTP Protocol
17. What are the types of Authentication in ASP.NET?
- Windows Authentication
- Forms Authentication
- Passport Authentication
18. What is Protected Configuration?
Ans: By using <CONTROL -name>Attributes.Add(scriptname,scripttext) method.
19. Difference between Web Config and Machine Config?
Ans: No. The code files must be in the same language to keep it in App_Code Folder.
20. What are the major built-in objects in ASP.NET? Ans:
Ans: Three types of Authentication -
Ans: It is used to secure connection string information.
Ans: Web config is specific for the web application whereas machine config is specific for the machine or server. Multiple web config files can be present into an application but only one machine config file can be there on a server