ASP.NET is a popular web framework developed by Microsoft, used as a backend service capable of building dynamic, fast, and scalable web applications. It is widely used by top companies such as Microsoft, Dell, Accenture, and many more because of its reliability, security, and enterprise-level features. Features of ASP.NET are:
- Cross-platform support
- High performance and scalability
- MVC (Model-View-Controller) architecture
- Built-in security features
- Easy integration with client-side frameworks
ASP.Net Interview Questions for Freshers
1. How does ASP.NET work?
ASP.NET works as a server-side web framework that processes client requests and generates dynamic web pages. It follows an event-driven model and integrates tightly with the .NET ecosystem.
- Request Handling: The web server (IIS or Kestrel) receives a client request and passes it to the ASP.NET runtime.
- Page Processing: ASP.NET executes server-side code (C#, VB.NET) to generate HTML, JSON, or XML responses.
- MVC Architecture: Separates the application into Model, View, and Controller to manage data, UI, and user interactions efficiently.
- State Management: Handles session and application state for user-specific and global data.
- Built-in Features: Provides authentication, authorization, caching, routing, and error handling out-of-the-box.
2. Write down the features of ASP.NET?
ASP.NET is popular among developers because of its robust features and versatility. Key features include:
- Extends .NET Framework: Adds libraries and tools for common web patterns like MVC, editor extensions, request processing, and Razor syntax for web-page templating.
- High Performance: Faster than many other web frameworks available in the market.
- Backend Development: Allows writing server-side logic and data access code using C#.
- Dynamic Pages: Razor syntax enables creating dynamic web pages. Can integrate with JavaScript and frameworks like React and Angular for Single Page Applications (SPA).
- Cross-Platform Support: Apps can be developed and run on Windows, Linux, macOS, and Docker. Visual Studio provides tools to build ASP.NET apps across different OS.
3. What is Common Language Runtime (CLR)?
CLR is the core runtime component of the .NET Framework that manages the execution of .NET programs. It provides a managed environment for running code and offers several key services:
- Code Execution: Executes programs written in any .NET language.
- Memory Management: Handles allocation and garbage collection automatically.
- Type Safety & Robustness: Ensures type safety and program reliability.
- Thread Management: Manages threads for concurrent execution.
- Remoting: Enables communication between application domains.
- Managed vs Unmanaged Code: Code targeting the CLR is called Managed Code, while code that doesn’t target it is Unmanaged Code.
4. What is ASP.NET MVC framework?
ASP.NET MVC is a lightweight, highly testable web application framework that separates an application into three main components: Model, View, and Controller.
- Model: Handles all data-related logic and business rules. It represents the data that flows between the View and Controller.
Example: A Customer model retrieves customer information from the database, manipulates it, and updates it back. - View: Manages the UI logic of the application and displays data to the user.
Example: The Customer view contains text boxes, dropdowns, and other UI elements for user interaction. - Controller: Acts as an interface between Model and View. It handles user requests, processes business logic using the Model, and returns the output to the View.
Example: The Customer controller processes inputs from the Customer view and updates the database using the Customer model.
5. Which would be the right framework to be used ASP.NET MVC or ASP.NET Web API?
The choice depends on the type of application you are building:
- ASP.NET MVC: Used to build web applications that return both views (UI) and data. Suitable for applications where server-rendered HTML pages are needed.
- ASP.NET Web API: Used to build HTTP services that return only data, not views. Ideal for RESTful services and APIs.
Key points about Web API:
- Supports content negotiation, allowing responses in different formats like JSON or XML based on client requests.
- Self-hosting is possible, providing flexibility in deployment.
- Returns data directly, whereas MVC returns data in JSON format using
JsonResult.
6. What is Server control?
Server Controls in ASP.NET are components that allow developers to manipulate UI elements on the server-side. They are especially useful for:
- Creating dynamic web forms.
- Performing server-side validation.
- Managing user input and control values programmatically.
7. What is the web.config file?
A configuration file (web.config) is utilized to oversee different settings that characterize a website. The settings are store in XML files that are independent of your application code. In this manner, you can configure settings freely from your code. This file stored inside the application root directory.

8. Which compiler is used in ASP.NET?
To complied an ASP.NET program .NET framework used the Roslyn compiler.
9. ASP.NET is open-source. Explain?
ASP.NET is an open-source web framework developed by Microsoft for building dynamic web applications, services, and websites. Key points:
- First released in 2002 as a successor to ASP (Active Server Pages) with improved scalability and functionality.
- Built on the .NET Framework, providing libraries and tools for web development.
- Supports standard HTTP protocols for web communication.
- ASP.NET Core, the cross-platform version released in 2016, allows development on Windows, Linux, and macOS.
- Continues to be actively updated and supported by Microsoft and the open-source community.
10. Explain the Global.asax file?
Global.asax is an optional file that resides in the application root directory. This file is used to handle higher-level application events, for example, Application_Start, Application_End, Session_Start, Session_End, and so on. It is additionally known as the ASP.NET Application File..Global.asax contains a Class representing your application as a whole. At run time, this file is parsed and compiled into a dynamically created .NET Framework class derived from the HTTP Application base class. We can convey this file as an assembly in the \bin catalog of an ASP.NET application. The Global.asax record itself is designed so that if a user demands the document, the request is denied. External users can't download or see the code written inside it.

11. How many types of Server controls are supported by ASP.NET?
ASP.NET supports four main types of server-side controls:
- HTML Server Controls: Standard HTML elements that run on the server.
- Web Server Controls: Rich, reusable controls provided by ASP.NET for UI and functionality.
- User Controls: Custom controls created by developers for reuse across pages.
- Validation Controls: Built-in controls used to validate user input on the server side.
12. What does “PostBack” mean in ASP.NET?
A PostBack is the process of sending an ASP.NET page from the client browser back to the server for processing. Key points:
- Used when certain actions require server-side processing, such as validating user credentials against a database.
- Initiated on the client-side but handled by the server-side code.
- Enables the server to update the page, maintain state, and return the processed output to the client.
13. Explain the difference between Web.config and Machine.config file?
ASP.NET uses configuration files to manage settings for applications. Key differences:
- Scope: Machine.config applies to all ASP.NET applications on the server. Web.config applies only to a specific web application.
- Location: Machine.config is located in
C:\Windows\Microsoft.NET\Framework\[version]\CONFIG and is created automatically with .NET Framework installation. Web.config is created automatically for each ASP.NET web application and can exist in subdirectories for specific configuration. - Purpose: Machine.config stores server-wide default settings shared across applications. Web.config stores application-specific settings like database connection strings and authentication.
- Changes: Web.config changes are applied immediately. Machine.config changes require restarting the applications.
- Number of Files: One Machine.config per .NET Framework installation. Each web application has its own Web.config.
14. Explain the differences between GridView and DataGrid?
Grid View | DataGrid |
|---|
It was introduced with Asp.Net 2.0. | It was introduced with Asp.Net 1.0. |
Built-in supports for Paging and Sorting. | For sorting you need to handle SortCommand event and rebind grid required and for paging, you need to handle the PageIndexChanged event and rebind grid required., |
Built-in supports for Update and Delete operations. | Need to write code for implementing Update and Delete operations. |
Supports auto-format or style features. | This feature is not supported. |
Performance is slow as compared to DataGrid | Performance is fast as compared to GridView. |
15. What is the difference between custom controls and user controls?
User Control | Custom Control |
|---|
User controls are created just like a web form. They make use of the existing controls to define their own logic. | A custom control is one that is made or created by the programmer to serve the business needs, by extending the functionality of existing controls. |
We can User control easily. | The creation of custom control is not easy as compare to user control |
These control do not run on their own dll. | While these control can run on their own dl. |
We can not add to the toolbox. | While we can add to the toolbox.we |
This control is not flexible. | This control is more flexible. |
Once we created a single copy of this control, we can use this copy to different projects as well. | We can not call or use a single copy of this control in different applications. For this, we need to create a control for each and every application. |
16. What are web controls in ASP.NET?
Web server controls are powerful than HTML server-side controls. The only difference is that they must have the runat = ”server” attribute set. This attribute makes the control available for server-side programming. Each ASP.NET Server Control is capable of exposing an object model containing properties, methods, and events. This object model can be utilized by the ASP.NET developers to modify and interact with the Web page. Web controls contain all basic controls of HTML controls as well as some new controls like as DataGrid, DataList, and Calendar.
WEB CONTROL | DESCRIPTION |
|---|
Label | Represents a label control |
ListBox | Represents a list box control |
CheckBox | Represents a Check box control |
Calendar | Represents a calendar control |
ImageButton | Represents an image button control |
TableCell | Represents a table cell |
Panel | Represents a panel control |
DataList | Represents a data list control |
TextBox | Represents a text box control |
Image | Represents an image control |
CheckBoxList | Represents a list box with checkboxes |
Button | Represents a button control |
HyperLink | Represents a hyperlink control |
TableRow | Represents a row of a table |
RadioButtonList | Represents a list box with radio button controls |
DataGrid | Represents a data grid control |
DropDownList | Represents a drop-down list control |
AdRotator | Represents an ad rotator control |
RadioButton | Represents a radio button control |
LinkButton | Represents a link button control |
Table | Represents a table control |
Repeater | Represents a repeater control |
17. Describe login Controls in ASP?
The ASP.NET supports robust login controls for web-based application which does not require any program coding. These login controls coordinate with ASP.NET participation and form authentication to help automated client verification for a server webpage. By default, the ASP.NET login controls work in plain text over HTTP. The ASP.NET supports different types of Login Controls like:
- Login Control
- LoginView Control
- LoginStatus Control
- LoginName Control
- PasswordRecovery Control
- CreateUserWizard Control
- ChangePassword Control


18. What are the different validation controls in ASP.NET?
Validation controls in ASP.NET are used to validate user input in web applications. They help ensure that data meets required conditions such as mandatory fields, value ranges, patterns, or custom rules. ASP.NET provides five main validation controls:
- RequiredFieldValidator: Ensures the user fills in a mandatory field.
- CompareValidator: Compares user input with a specified value using operators like less than, greater than, or equal.
- RangeValidator: Checks that the user input falls within a defined range.
- RegularExpressionValidator: Validates that the input matches a specific pattern.
- CustomValidator: Allows developers to define custom validation logic for specific conditions.
19. Why do we use CheckBox in .NET?
This control creates a check box on a Web Forms page, allowing users to set a true or false value for the item associated with the control. The properties of the CheckBox are:
- Checked: This is true if the checkbox is checked, otherwise false. The default value is false.
- TextAlign: TextAlign is the position of the caption. The possible values are Right and Left. The default is Right to align.
- Text: This defines the checkbox caption.
HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs"
Inherits="WebApplication10.WebForm2" %>
<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml/">
<head runat="server">
<title></title>
<style type="text/css">
#form1 {}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
Eligibility criteria for take admission in Master of Technology
<br />
</div>
<asp:CheckBox ID="CheckBox1" runat="server" Text="HSC" />
<br />
<asp:CheckBox ID="CheckBox2" runat="server" Text="SSC" />
/ Polytechnic<br />
<asp:CheckBox ID="CheckBox3" runat="server" Text="BE" />
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Submit " />
<asp:Label ID="Label1" runat="server" ForeColor="Lime"
Text="Label"></asp:Label>
</form>
</body>
</html>
Output 1:

Output 2:

20. Explain the HTML server controls in ASP.NET?
HTML Server Controls : HTML elements are exposed to the server. They expose an object model that maps very closely to the HTML elements that they render. You can run these controls on the server by defining the runat ="server" attribute.
| CONTROL | DESCRIPTION |
|---|
| HtmlForm | Create an HTML form control, used as a placeholder for other controls. |
| HtmlInputText | Creates an input text box control used to get input from the user. |
| HtmltextArea | Creates multi-line text box control. |
| HtmlAnchor | Creates Web navigation. |
| HtmlButton | Creates a button control. |
| HtmlImage | Creates an image control, which is used to display an image. |
| HtmlInputCheckBox | Creates a checkbox control. |
| HtmlInputRadioButton | Creates a radio button control. |
| HtmlTable | Creates a table control. |
| HtmlTableRow | Creates a row within a table. |
| HtmlTableCell | Creates a cell within a row. |
21. What is LINQ?
LINQ is known as Language Integrated Query was introduced in .NET 3.5 and Visual Studio 2008. It allows .NET languages like C# and VB.NET to generate queries directly within the language to retrieve data from various data sources. Key points:
- LINQ enables querying data from collections, databases, XML files, ADO.NET datasets, web services, and other compatible sources.
- The query syntax is consistent across all data sources, so you don’t need to learn SQL or other query languages separately.
- It simplifies data access by integrating querying capabilities directly into .NET languages.
22. What is ASP.NET Core?
ASP.NET Core is the open-source, cross-platform version of ASP.NET that runs on Windows, Linux, and macOS. Key points:
- First released in 2016 as a redesign of previous Windows-only ASP.NET versions.
- Supports modern web development with improved performance, scalability, and flexibility.
- Introduces cross-platform capabilities, allowing developers to build and run applications on multiple operating systems.
- Offers the benefits of open-source development, including community contributions and frequent updates.
23. What is Razor in ASP.NET?
Razor is a view engine in ASP.NET that provides a syntax for developing dynamic web pages using C# and HTML.
- Enables seamless integration of server-side code with HTML markup.
- Supports building Single Page Applications (SPA) when combined with JavaScript frameworks like React and Angular.
- Simplifies rendering dynamic content in web pages with clean and concise syntax.
24. What are the types of Authentication in ASP.NET?
Authentication in ASP.NET is the process of verifying a user’s identity, usually using credentials like a user ID and password. Once authenticated, the user can proceed to authorization.
Types of Authentication in ASP.NET:
- Forms Authentication: Validates users against a database or custom user store using forms.
- Passport Authentication: Uses Microsoft Passport (deprecated in modern apps) for authentication.
- Windows Authentication: Uses Windows accounts and Active Directory for authentication.
- Custom Authentication: Allows developers to implement their own authentication logic.
25. What is Query String in ASP? And what are its advantages and disadvantages?
A QueryString is a collection of characters input to a computer web browser. It is helpful when we want to transfer a value from one page to another page. If the sending data is in large quantity then we can not use Request.QueryString because it supports only 255 characters. We use the ‘&’ special character for separate multiple query strings. Any query string that was available to the calling ASPX page will be available to the called ASPX page.
26. Briefly describe the difference between the Web Site and Web Application?
A Web Application is a software program accessed through a browser that requires authentication and interacts with the server using a combination of server-side and client-side scripts. It processes user requests dynamically. Example: Google Apps.
A Web Site is a collection of related web pages containing text, images, audio, or video that users can view in a browser. Websites are primarily informational and may not require user authentication. Example: Amazon, YouTube.
27. Explain View State?
View state is the method that the ASP.NET page framework uses to preserve page and control values between round trips.
HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs"
Inherits="WebApplication9.WebForm4" %>
<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml/">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h6>Example of View State:</B></h6>
<p><B><I><U>WELCOME TO GEEKSFORGEEKS</B></I></U></p>
Page Counter:
<br />
<br />
<asp:Label ID="lblCounter" runat="server" />
<br />
<br />
<br />
<asp:Button ID="btnIncrement" runat="server"
Text="Number of Visitors Count" OnClientClick="btnIncrement_Click" />
</div>
</form>
</body>
</html>
Output:

28. Explain Cookies in ASP.NET?
A Cookie is a small piece of information sent from a server to a browser and stored on the client’s machine. Cookies are sent back to the server with each subsequent request, allowing the server to remember user-specific data. Key points:
- Used for authentication, session management, and personalization.
- Stores information such as username or preferences so users don’t have to re-enter details on each page.
- In ASP.NET, the
Request.Cookies and Response.Cookies properties are used to access and manage cookies.
29. Explain the purpose of Web Services in ASP.NET?
Web Services in ASP.NET are web applications that expose methods for use by other applications. Key points:
- They follow a code-behind model similar to ASP.NET pages but do not have a user interface.
- Enable interoperability by allowing different applications to communicate over the web.
- Used to provide reusable functionality, such as data access or business logic, to multiple clients.
30. Write a step for Request Flow in ASP.NET MVC framework?
The sequence for Request Flow in ASP.NET MVC is as follows:
- Request: In this step firstly request is received. After that, in the Global.asax file, route objects are added to the Route table object.
- Routing: At the second step routing is performed. After the application gets from the client, it uses URL Routing Module to deal with the request. The Route Table guides URLs to handlers. A routing is coordinating with a system that matches with the request's URL against the URL patterns which are available in the Route Table. The Routing engine diverts the request to the relating IRouteHandler when the match is found in the pattern. Assuming relating mentioned URL is not found in the routing table, it will return a 404 HTTP status code.
- MVC Handler: A RouteHandler responsible for deciding the HTTP handler that will serve the request, according to the received RequestContext.
- Controller: In this step, the controller decides which action method is to be executed.
- Action Executed: After the controller gets instantiated ActionInvoker will determine which Action method needs to execute. ActionNameSelectorAttribute and ActionMethodSelectorAttribute methods used to select action method. The action method receives user input then executes the result and returning a result type to view.
ASP.NET Core Advanced Interview Questions
31. Explain the various modes for the Session state in ASP.NET?
- InProc: Sessions are stored within the application's process on a web server. Depending on the IIS rendition utilized that could be aspnet_wp.exe or w3wp.exe.
- StateServer: Sessions are stored by utilizing State Server windows administration service.
- SQLServer: SQL Server database is utilized to store sessions' information.
- Custom: A custom session state provider manages all the session states.
32. Write down different return types of a controller action method?
- ViewResult: Returns a View (HTML page) to the client. Example:
return View(); - JavaScriptResult: Returns JavaScript code that can be executed on the client side. Example:
return JavaScript("alert('Hello');"); - RedirectResult: Redirects the client to a different URL. Example:
return Redirect("https://example.com"); - JsonResult: Returns data in JSON format, often used for AJAX calls. Example:
return Json(data, JsonRequestBehavior.AllowGet); - ContentResult: Returns plain text or other content types. Example:
return Content("Hello World");
33. How to maintain sessions in MVC?
We can maintain sessions in MVC using three different ways:
- Temp data
- Viewdata
- View bag
34. How would you explain the differences between Repeater and ListView?
Repeater Control
- Derived from the Control class, used to repeat data using templates.
- Output is not predefined → gives maximum flexibility but requires more template work.
- Fastest among Repeater, DataList, and GridView (uses DataReader for read-only access).
- Limited features: no built-in editing, paging, or sorting.
Data Controls Comparison
- Repeater → Simplest, fastest, least features.
- DataList → More features than Repeater but heavier.
- GridView → Richest features (editing, paging, sorting) but slowest.
ListView Control (ASP.NET 3.5 onwards)
- Combines speed + flexibility of Repeater with features of DataList/GridView.
- Supports paging, editing, updating, and deleting.
- Often preferred choice over Repeater or DataList.
35. Describe loginStatus Controls in ASP?
The ASP.NET supports a robust login controls for web-based application which does not require any program coding. The LoginStatus control is a very simple control, all it does is display a link that is different depending on whether the user is logged in or logged out. If a user is logged in then it displays a LogOut link and vice versa.
There are few properties that it supports, LogOutAction can be used to specify what happens when a user clicks on the LogOutLink, and the options are Redirect, RedirctToLoginPage, Refresh. If we set it to Redirect then we must set another property LogOutPage Url which a user is redirected to after logging out of the website.
HTML
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication10.WebForm1" %>
<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml/">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Welcome To GeeksForGeeks<br />
<asp:LoginStatus ID="LoginStatus1" runat="server"
ForeColor="#CC0000" LoginText="Click here for Login" />
<br />
<br />
<asp:LoginStatus ID="LoginStatus2" runat="server"
ForeColor="#CC0000" LoginText="Click here to Logout" />
<br />
</div>
</form>
</body>
</html>
Output:

36. What do you know about JIT?
Just-In-Time(JIT) Compiler: Just-In-Time compiler(JIT) is a part of Common Language Runtime (CLR) in .NET which is responsible for managing the execution of .NET programs regardless of any .NET programming language. A language-specific compiler converts the source code to the intermediate language. This intermediate language is then converted into the machine code by the Just-In-Time (JIT) compiler. This machine code is specific to the computer environment that the JIT compiler runs on.
37. What is RedirectPermanent in ASP.Net?
The RedirectPermanent(String) method overload gives a 301 HTTP status code in the reaction and incorporates the URL to divert the request. A 301 HTTP status code is a standard code in an HTTP reaction. It shows that a lasting redirection exists, and it gives the redirection area.
38. What is AJAX in ASP.NET?
The full form of ASP.NET AJAX is Asynchronous JavaScript and XML. ASP.NET AJAX also known as AJAX, is a bunch of augmentations of ASP.NET. It uses asynchronous data transfer between browser and webserver to allow web pages to request small bits of information from the server instead of entire pages. This technique makes Internet applications smaller, faster, and more user-friendly. It is created by Microsoft to execute AJAX functionalities in Web applications. The ASP.NET AJAX works with the AJAX Library that utilization object-arranged programming (OOP) to faster rich Web applications.
39. What is Round Trip in ASP.NET?
At the point when server-side processing is included, then there are four stages included:
- A user requests a Web form from the Web server.
- Web Server reacts back with the mentioned Web form.
- The user enters the information and submits the webform to the webserver.
- Then Web Server processes the form structure and sends the outcomes back to the particular user.
Now, stage 3 is known as a page postback, while stages 3 and 4 are aggregately known as a "roundtrip". We can say that- "A roundtrip includes making a total excursion over the network to the Web browser and getting the reaction back. The Web applications use HTTP to build up correspondence between the Web program and the Web server.
40. What is the REST architecture?
REST stands for REpresentational State Transfer.REST is an architectural style that doesn’t follow any strict standard but follows six constraints defined by Roy Fielding in 2000. Those constraints are – Uniform Interface, Client-Server, Stateless, Cacheable, Layered System, Code on Demand.REST is not restricted to XML and it's the choice of implementer which Media-Type to use like XML, JSON, Plain-text. Moreover, REST can use SOAP protocol but SOAP cannot use REST.REST is easy to implement and requires less bandwidth such as smartphones.
Architectural Constraints of RESTful API: There are six architectural constraints that make any web service are listed below:
- Uniform Interface
- Stateless
- Cacheable
- Client-Server
- Layered System
- Code on Demand
41. What is Caching and its different types?
In Asp.Net the caching method allows to store or cache Web Page output. This technic is used to avoiding the overhead of recreating the same data. There are three different caching types available in ASP.NET:
- Page Output Caching
- Page Fragment Caching
- Data Caching
Caching increases the performance parameter if the same data or information is requested by the user.
- Page Output Caching: It is implemented by placing an OutputCache directive at the top of the .aspx page at design time.
- Data Caching: It is used for quick retrieval of application data and implemented by the Cache object.
- Page Fragment Caching: It is used to store part of a Web form response in memory by caching a user control.
42. What does the method Finalize do in ASP.NET?
The Finalize technique is utilized to perform a cleanup procedure on unmanaged resources held by the current object before the object is destroyed. The strategy is ensured and subsequently is available just through this class or through a derived class.
43. Write down the name of all steps in the ASP.NET page life cycle?
- Page request
- Starting of page life cycle
- Page initialization
- Page Load
- Validation
- Postback event handling
- Page rendering
- Unload
44. What is tracing in .NET?
ASP.NET includes an easy-to-use functionality that helps to debug Web applications. Tracing functionality allows debugging print statements to be inserted into the code to output variables or structures, assert whether a condition is met, or trace through the execution path of the application. Trace feature is used to track particular types of actions in a deployed application as they occur (for example, database connections), and can thus monitor the application’s efficiency. The new tracing features of ASP.NET allow simulating Response.Write() statements. The users need not worry about removing the statements before deploying the applications. Instead of using Response.Write(), Trace.Write() is used. The Trace object is an intrinsic page object, similar to Request, Response, Server, etc. It is accessible directly with the page code.
Trace class: A Trace class is used to get information about Trace. When the Trace property is used, an instance of the TraceContext class is defined in the System.Web namespace. Trace class provides a set of methods and properties that help to trace the execution of code. Instrumentation allows monitoring the health of the application running in real-life settings. Tracing helps to isolate problems and fix them without disturbing a running system.
There are two different ways to enable tracing:
- In C# or Managed Extensions for C++, the /d: TRACE flag can be added to the compiler command line. In Visual Basic, the /d: TRACE=True flag can be added to the compiler command line
- The #define TRACE can be added to the top of the file. This syntax is compiler-specific. If the user is using a compiler other than the ones specified above, the compiler’s documentation has to be referred to enable conditional compilation
45. Write down different Trace Methods provided in ASP.NET?
- Assert() - Checks for a condition, and displays a message if the condition is false.
- Close() - Cleanup the output buffer, and then closes the Listeners so that they no longer receive debugging output.
- Fail() - This method emits an error message.
- GetType() - It is used for "Gets the Type of the Object".
- ToString() - Returns a String that represents the current Object
- GetHashCode() - This method works like a hash function for a particular type. It is suitable for use in hashing algorithms and data structures like a hash table.
- Equals() - Determines whether the specified Object is the same instance as the current Object
- Warn() - Writes trace information, along with optional exception data, to the trace log. All warnings appear as red text. It has two forms. The first form writes trace information to the trace log including any user-defined categories.
- Write() - Writes trace information to the trace log. It has two forms. The first form writes trace information to the trace log, including any user-defined categories and traces messages.
46. Explain Local Resources and Global Resources?
A local resource is explicit to a specific page, which is the one in particular who can get to it, while global resources can be accessed from any place. Local resources are kept in the App_LocalResources organizer, while global are kept in the App_GlobalResources folder. Local and global resources records will appear to be identical, so the only distinction is the folder they reside in. But they are utilized in different.
47. Write down various page events in ASP.NET?
- PreInit
- Init
- InitComplete
- LoadViewState
- LoadPostData
- PreLoad
- Load
- LoadComplete
- PreRender
- PreRenderComplete
- SaveStageComplete
- UnLoad
48. What is Navigation control in ASP.NET?
Navigation Control is defined as a menu that can be stored in a file to make it easier to maintain. This file is normally called web.Sitemap, and is stored in the root directory of the web. An ASP.NET has three different types of Navigation control:
- Dynamic Menus
- TreeView
- Site Map path
49. Describe TreeView control?
The TreeView control is made up of nodes. Each entry in the tree is called a node and is represented by a TreeNode object. A node that contains other nodes is called a parent node. A node that is contained by another node is called a child node. A node that has no child nodes is called a leaf node. A node that is not contained by any other node but is the ancestor to all the other nodes in the root node. A node can be both a parent and a child, but root, parent, and leaf nodes are mutually exclusive. Several visual and behavioural properties of nodes are determined by whether a node is a root, parent, or leaf node.
50. Explain ADO.net?
ASP.NET has introduced the next generation of ADO known as ADO.NET with respect to data access. ADO.NET places more emphasis on disconnected recordsets by employing XML as a medium of communication between these record sets and the DataStore.ADO.NET is the latest of the database access technologies that began with the Open Database Connectivity (ODBC) application programming interface (API).
- Microsoft introduced open database connectivity with the promise of creating a singular common access methodology for databases. ODBC has come a long way since those early days.
- Almost every major database in use today supports ODBC drivers, and third-party developers provide optimized driver versions. The primary focus of the ODBC is to provide a consistent interface to database data sources.
Explore
Introduction
Fundamentals
Control Statements
OOP Concepts
Methods
Arrays
ArrayList
String
Tuple
Indexers