Advertise with Us!
We have a variety of advertising options which would give your courses an instant visibility to a very large set of developers, designers and data scientists.View Plans
Table of Contents
You are an ASP.NET programmer… Your next job interview is round the corner… You want to score that job… All that means is that you need to prepare well despite being knowledgeable in the domain. Generally, in technical job interviews, interviewers will not only ask complex questions, but you may also even face some very fundamental and rudimentary questions which can make or break the chance to win.
ASP.Net Interview Questions
You may need more than this set of questions to arm yourself fully for the interview. We recommend you to visit ASP .NET Tutorials and Courses, where you can find more reading material and get a full grip of ASP.NET.
Question 1: What is ASP.NET?
Answer: ASP.NET is an open-source server-side application framework designed for web developers to produce dynamic web pages with .NET framework. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services.
Question 2: What is ASP.NET MVC framework?
Answer: ASP.NET MVC is a web application framework for the .NET Platform used for building full stack web applications using the Model-View-Controller pattern.
Question 3: What is an ASP.NET Web API framework?
Answer: ASP.NET Web API is used purely for building backend web APIs which can be used by an array of clients, from the web to desktop to mobile. It forms the server component in the RESTful (Representational State Transfer) architecture.
Question 4: Which would be the right framework to be used ASP.NET MVC or ASP.NET Web API?
Answer: If one intends to build a server component that can be easily utilized by an array of clients then ASP.NET Web API is the way to go. If, however, the project is purely going to be used as a web application, then ASP.NET MVC is a more appropriate choice.
Question 5: What is the web.config file and what is used for?
Answer: The web.config file is crucial because it contains the configuration settings for the application. It keeps your entire configuration separate from your code so you can easily change settings without code changes. It also allows you to potentially encrypt the configuration settings for increased security.
Question 6: Which compiler is used in ASP.NET?
Answer: Roslyn is the name of the compiler used by .NET Framework.
Question 7: ASP.NET is open-source. Explain.
Answer: Microsoft is providing the full .NET server stack in open source which means it is a ‘free’ download. This includes ASP.NET, the .NET compiler, the .NET Core Runtime, Framework, and Libraries, enabling developers to build with .NET across Windows, Mac or Linux.
Question 8: Explain the request flow in ASP.NET MVC framework.
Answer: Request flow handles the request from the clients and passes it to the server. Request hits the controller coming from the client. Controller plays its role and decides which model to use in order to serve the request further, passing that model to view which then transforms the model and generates an appropriate response that is rendered to the client.
Question 9: What does “PostBack” mean in ASP.NET?
Answer: A PostBack happens when a user takes some action (like submitting a form) that sends information from the page to the server for processing via POST method.
Question 10: Explain the ASP.NET page life cycle in brief.
Answer: ASP.NET goes through a series of stages in the life cycle of each page.
- Page request. The user requests a page. ASP.NET decides whether to compile it or serve it from a cache.
- Page Start. The Request and Response objects are created.
- Page Initialization. All page controls are initialized, and any themes are applied.
- Page Load. ASP.NET uses the view state and control state properties to set the control properties. Default values are set in the controls.
- Postback event handling. This event is triggered if the same page is loaded again.
- Rendering. ASP.NET saves the view state for the page and writes the output of rendering to the output stream. It happens just before the complete web page is sent to the user.
- Unload. The rendered page gets sent to the client. ASP.NET unloads page properties and performs cleanup. All unwanted objects are removed from memory.
Question 11: What is view state in ASP.NET?
Answer: View state is where data is used to preserve page values and control values of Web Forms during postback event handling. Data can be stored as hidden fields on the client web page.
Question 12: What is the difference between custom controls and user controls?
Answer: Custom controls are basically compiled code, i.e., DLLs. These can be easily added to the toolbox, so it can be easily used across multiple projects using a drag-and-drop approach. These controls are comparatively hard to create. But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly coupled with respect to User Interface and code.
Question 13: What are the different Validators in ASP.NET?
Answer: ASP.NET validation controls define an important role in validating the user input data. Whenever the user gives input, it must always be validated before sending it across the various layers of an application. There are two types of validation in ASP.NET:
- Client-Side Validation
- Server-Side Validation
Server-Side Validation: When validation occurs on the server, then it is known as Server-Side Validation. Server-Side Validation is a secure form of validation. The main advantage of Server-Side Validation is if the user bypasses the Client-Side Validation, the problem can be caught on the server-side.
The following are the Validation Controls in ASP.NET:
- RequiredFieldValidator Control
- CompareValidator Control
- RangeValidator Control
- RegularExpressionValidator Control
- CustomFieldValidator Control
Question 14: What does the method Finalize do in ASP.NET?
Answer: The Finalize method is used to perform cleanup operations on unmanaged resources held by an object. It puts an object in the finalization queue. The Object will then be collected by the garbage collector ready to be cleaned up.
Question 15: What is RedirectPermanent in ASP.Net?
Answer: RedirectPermanent Performs a permanent redirection from the requested URL to the specified URL. Once the redirection is done, it also returns http 301 status code to the browser.
Question 16: What is the function of the LoginStatus Control?
Answer: LoginStatus control is used to display Login/Logout links based on the login/authorization status of the current user. If the user has successfully logged in, the Logout link will be displayed.
Question 17: What is a Repeater Control and what are the templates supported by the Repeater?
Answer: A Repeater is a Data-bound control. Data-bound controls are container controls. It creates a link between the Data Source and the presentation UI to display the data. The repeater control is used to display a repeated list of items. A Repeater has five inline templates to format it:
- - Displays Header text for a Data Source collection and applies a different style for the Header text.
- - Changes the background color or style of alternating items in a Data Source collection.
- - It defines how each item is rendered from the Data Source collection.
- - It will determine the separator element that separates each item in the item collection. It could be a
- - Displays a footer element for the Data Source collection.
Question 18: What are the different Session state management options available in ASP.NET?
Answer: In-Process and Out-of-Process are the two session state management options.
- In-Process stores the session in memory on the web server.
- Out-of-Process Session state management stores data in an external server. All objects stored in session are required to be serializable.
Question 19: What is the difference Between Server.Transfer and Response.Redirect?
Answer: Server. Transfer sends information from one web request to another, all on the server side. A response is not sent to the browser. On the other hand, Response.Redirect sends an HTTP 302 message to the browser and causes a redirect in the browser.
Question 20: What is fragment caching?
Answer: Fragment caching refers to the caching of individual user controls within a Web Form. Each user control can have independent cache durations and implementations of how the caching behavior is to be applied. Fragment caching is useful when you need to cache only a subset of a page.
Question 21: What are web controls in ASP.NET?
Answer: Web controls are classes in the .NET framework. The controls have special tags understood by the server. They are created on the server and require a run at=”server” attribute to execute. They generate HTML code that is sent back to the browser.
Question 22: Give some examples of web controls.
Question 23: What is a web service?
Answer: A Web service, in the context of .NET, is a component that resides on a Web server and provides information and services to other network applications using standard Web protocols such as HTTP and Simple Object Access Protocol (SOAP).
Question 24: What is the difference between session and application object?
Answer: The difference between session and application object is that all users share one Application object and with sessions, there is one session object for each user. Data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key-value pair. Session object stores session-specific information and the information are visible within the session only. ASP.NET creates unique SessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the applications configuration settings. By default, SessionID values are stored in cookies.
Question 25: What is Caching and what are the benefits of using it?
Answer: Caching is a mechanism that improves performance for an application by storing data in the memory for faster access. When the application accesses data from Cache (i.e. in-memory) instead of fetching it from the original data store (maybe a database), it definitely improves performance. But Caching benefits are not limited only to performance; it also improves application Scalability and Availability.
Question 26: What are the types of Authentication in ASP.NET?
Answer: There are three types of authentication available in ASP.NET:
- Windows Authentication: This authentication method uses built-in Windows security features to authenticate a user.
- Forms Authentication: Authenticates against a customized list of users or users in a database.
- Passport Authentication: Validates against Microsoft Passport service which is basically a centralized authentication service.
Question 27: What is ASP.NET AJAX?
Question 28: What is the REST architecture?
Answer: REST (Representational State Transfer) is an architectural style for designing applications and it dictates to use HTTP for making calls for communications instead of complex mechanism like CORBA, RPC or SOAP. There are few principles associated with REST architectural style:
- Everything is a resource i.e. File, Images, Video, WebPage etc.
- Every Resource is identified by a Unique Identifier.
- Use simple and Uniform Interfaces.
- Everything is done via representation (sending requests from a client to server and receiving responses from server to client).
- Be Stateless- Every request should be an independent request.
Question 29: ASP.NET is cross-platform Explain.
Answer: ASP.NET applications can be developed and run on any operating systems like Windows, Linux, macOS, and Docker. Hence it is called a Cross-platform framework.
Question 30: What is Razor in ASP.NET
Answer: Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into web pages. The server-based code can create dynamic web content on the fly, while a web page is written to the browser. When a web page is called, the server executes the server-based code inside the page before it returns the page to the browser. By running on the server, the code can perform complex tasks, like accessing databases. Razor is based on ASP.NET, and designed for creating web applications. It has the power of traditional ASP.NET markup, but it is easier to use and easier to learn.
Question 31: What is ASP.NET Core?
Answer: ASP.NET Core is the open-source and cross-platform version of ASP.NET. The Windows-only versions of ASP.NET, that existed before ASP.NET Core, is typically just referred to as ASP.NET.
Still not through with your preparation? Check out this best udemy course to prepare for an ASP.Net-based interview: C# for Beginners.
Generic programming questions are inherent to any programming interview. Here is a great book with top coding and programming questions and answers: Cracking the Coding Interview: 189 Programming Questions and Solutions.
People are also reading:
- Top C# Interview Questions
- Java Interview Questions
- SQL Interview Questions
- Best Python Interview Questions
- Check here HCL Recruitment Process or Interview Questions & Answers
- Difference between C# vs C++
- Difference between HTML vs HTML5 vs XHTML
- Jquery Interview Questions