Introduction
Active Server Pages (ASP) and Active Server Pages (ASP.NET) are server-side technologies for displaying interactive web pages.
ASP.NET offers developers a wide range of options in a large, diverse ecosystem of libraries and tools. Developers can also design custom libraries that can be shared with any .Net platform application.
ASP.NET is a web development platform that includes a programming paradigm, a comprehensive software infrastructure, and a number of services for developing sophisticated web applications for both PCs and mobile devices.
ASP.NET is built on top of the HTTP protocol, and it makes use of HTTP commands and policies to establish bidirectional communication and cooperation between the browser and the server.
The Microsoft.Net platform includes ASP.NET. ASP.NET applications are compiled code built with the .Net framework's extensible and reusable components and classes. These programmes can access the entire .Net framework class hierarchy.
In this blog, we will discuss the standard ASP.NET interview questions and their answers.
Basic ASP.NET Interview Questions
1. What is ASP.NET?
The ASP.NET is a component of the .NET Framework that may be used to build dynamic websites, online applications, and web services. It's a server-side technology that works with any .NET compatible languages, such as C#, VB.NET, and J#, and compiles them to Microsoft Intermediate Language (MSIL). ASP.NET makes it simple to create a fast and interactive application using server controls.
ASP.NET has the following features:
- It builds websites using the C# and VB.NET programming languages.
- It allows us to keep the HTML layout and server-side code separate.
- It enables us to qualify the same class name in a separate namespace.
- The pages in ASP.NET are compiled rather than interpreted.
- ASP.NET is a request processing engine. It receives an incoming request and routes it through its internal pipeline to an endpoint to which a developer may attach code to process it.
2. What is the ASP.NET MVC framework?
ASP.NET MVC is a lightweight web application framework with a lot of tested features. Model, View, and Controller are the three types of components supported by ASP.NET.
- The Model component relates to all or any of the data-related logic with which the user interacts. This will represent the data being transmitted between the View and Controller components, as well as any other business logic-related data. A Customer object, for example, will retrieve customer information from a database, change it, and either update or output the data back to the database.
- The View component is used for all of the appliance's user interface logic. For example, the Customer view will have all of the UI components that the final user interacts with, such as text boxes, dropdowns, and so on.
- Controllers serve as a link between the Model and Consider components, processing all business logic and incoming requests, manipulating data with the Model component, and interacting with Views to render the final output. The Customer controller, for example, will handle all interactions and inputs from the Customer View and use the Customer Model to update the database. The Customer data will be viewed by an analogous controller.
3. Which would be the correct framework to be used ASP.NET MVC or ASP.NET Web API?
ASP.Net MVC is used to create online applications that return both the view and the data, whereas Asp.Net Web API is used to create all HTTP services in a simple and basic approach that only returns data, not the view.
Web API allows you to create RESTful services using the.NET Framework, and it also includes features like content negotiation and self-facilitating that aren't available in MVC.
Web API also deals with returning information that is particularly intended, such as JSON, XML, or another, based on the Accept header in the request, and you don't have to worry about it. Using Json Result, MVC simply returns information in JSON format.
4. What is Server control?
Server Controls are capabilities in ASP.NET that allow you to manipulate the values of controls on the server side. This is extremely useful when creating verifying and dynamically generated web forms.
5. What is Razor in ASP.NET?
Razor in ASP.NET provides the syntax for creating dynamic web pages using C# and HTML. For SPAs, ASP.NET may be combined with JS (JavaScript) and contains frameworks such as React and Angular (Single Page Application.)
6. What is the REST architecture?
REST is the acronym for REpresentational State Transfer. REST is an architectural approach that follows six restrictions specified by Roy Fielding in 2000, rather than a rigorous standard. Uniform Interface, Client-Server, Stateless, Cacheable, Layered System, and Code on Demand are the limitations. REST is not limited to XML, and it is up to the implementer to decide which Media-Type to use, such as XML, JSON, or plain-text. Furthermore, REST can make use of the SOAP protocol, but SOAP cannot make use of REST. REST is simple to set up and uses less bandwidth, making it ideal for mobile devices.
RESTful API Architectural Constraints: The following are six architectural restrictions that any web service must meet:
- Stateless
- Cacheable
- Client-Server
- Layered System
- Code on Demand with a Uniform Interface
7. What are the different types of Authentication in ASP.NET?
Authentication is the process of determining a user's identity based on their credentials. Users' credentials are often in the form of a user ID and password, and we check them against a database or equivalent alternative to see if they exist. If they do, the user is a valid candidate for the next step - authorisation. In ASP.NET, there are several types of authentication to choose from, including:
- Form Authentication
- Passport Authentication
- Windows Authentication
- Custom Authentication
8. What is Caching and its different types?
The caching function in Asp.Net allows you to save or cache Web Page output. This technique is used to save time by not having to recreate the same data. In ASP.NET, there are three different methods of caching:
- Caching of page output
- Caching of page fragments
- Caching of data
If the user requests the same data or information repeatedly, caching improves performance.
- Caching of page output: It's done by adding an OutputCache directive to the top of the.aspx page during the design phase.
- The Cache object implements data caching, which is useful for rapid retrieval of application data.
- Page Fragment Caching: This technique caches a user control to store a portion of a Web form response in memory.
9. What is Query String in ASP? And what are its advantages and disadvantages?
A QueryString is a string of characters entered into a web browser on a computer. It comes in handy when we need to move a value from one page to another. We can't use Request if we're sending a significant amount of data. Since it only supports 255 characters, it's called QueryString. To separate numerous query strings, we utilise the '&' special character. The called ASPX page will have access to any query string that was available to the calling ASPX page.
10. What does the method ‘Finalize’ do in ASP.NET?
Before the current object is destroyed, the Finalize technique is used to run a cleanup procedure on unmanaged resources owned by the current object. The strategy is guaranteed, and it is then available only through this class or a derived class.
11. What are the steps in the ASP.NET page life cycle?
- Starting of page life cycle
- Page request
- Page Load
- Page initialization
- Postback event handling
- Validation
- Unload
- Page rendering
12. What is the web.config file?
The configuration file (web.config) is used to manage the various settings that distinguish a website. The settings are stored in XML files which are different from the code of your programme. This allows you to freely configure settings from your code. This file is located in the root directory of the application.
13. Which compiler is used in ASP.NET?
To put together an ASP.NET programme, the Roslyn compiler was used by the NET framework.
14. ASP.NET is open-source. Explain?
On the .NET (dotNET) platform, ASP.NET is an open-source web framework for developing web applications. Microsoft released version 1.0 in 2002, allowing users to create dynamic online applications, services, and websites. The framework is built to interact with the HTTP convention, which is the most widely used protocol for web-based applications. ASP.NET is the next version to the ASP (Active Server Pages) technology, and it represents a substantial advancement in terms of adaptability and capability. It's an add-on to the .NET framework that includes additional tools and libraries for developing web-based apps and websites. ASP.NET Core is the cross-plate form version of ASP.NET, which was released in 2016. The ASP.NET framework is still being upgraded.
15. Explain the Global.asax file?
Global.asax is a file present in the application root directory that is optional. Session Start, Session End, Application Start, Application End and other application events are handled in this file. The ASP.NET application file is another name for it. Global.asax contains a class which represents your entire application. This file is compiled at runtime into a dynamically generated .NET class based on the HTTP Application base class. This file can be sent as an assembly to an ASP.NET application's bin catalogue. The Global.asax record is built in such a way that if a user requests the document, it will be rejected. External users are unable to download or view the code contained within it.
16. What all types of Server controls are supported by ASP.NET?
In ASP.NET, there are four primary types of server-side controls:
- Web Server controls
- HTML server controls
- Validation controls
- User controls