Top 50 Asp.Net Interview Questions and Answers

  1. What is ASP.NET?
ASP.NET Core: What Is It and Top 5 Advantages of .NET Core
ASP.NET

ASP.NET (Active Server Pages . NET) is a progressive new programming framework that empowers the rapid improvement of powerful web applications and administrations. It is a part of the Microsoft .NET Platform, it gives the simplest and most versatile approach to create, deploy and run web applications that can focus on any browser or device.ASP.NET is built on the CLR(Common Language Runtime) which allows the programmers to execute its code using any .NET language(C#, VB, etc.). It is specially designed to work with HTTP and for web developers to create dynamic web pages, web applications, websites, and web services as it provides a good integration of HTML, CSS, and JavaScript.

.NET Framework is used to create a variety of applications and services like Console, Web, and Windows, etc. But ASP.NET is only used to create web applications and web services. That’s why we termed ASP.NET as a subset of the .NET Framework.

2. What is Common Language Runtime (CLR)?

CLR is the basic and Virtual Machine component of the .NET Framework. It is the run-time environment in the .NET Framework that runs the codes and helps in making the development process easier by providing various services such as remoting, thread management, type-safety, memory management, robustness, etc. Basically, it is responsible for managing the execution of .NET programs regardless of any .NET programming language. It also helps in the management of code, as code that targets the runtime is known as the Managed Code, and code that doesn’t target to runtime is known as Unmanaged code.

3. Write down features of ASP.NET?

Feature of ASP.NET

There are a lot of reasons which make ASP.NET popular among developers. Some reasons are listed below:

  • Extending .NET Framework: ASP.NET is a subset of the .NET Framework as it extends the .NET Framework with some libraries and tools to develop web apps. The thing that it adds to the .NET Framework is Libraries for common web patterns like MVC, Editor Extensions, the base framework to process the web requests, and web-page templating syntax like Razor, etc.
  • Performance: It is faster than the other web frameworks available in the market.
  • Backend Code: With the help of ASP.NET you can write the backend code for data access and any logic in C#.
  • Dynamic Pages: In ASP.NET, Razor provides the syntax for developing dynamic web pages with the help of C# and HTML. ASP.NET can be integrated with JavaScript and it also includes the frameworks like React and Angular for the SPA(Single Page Application.)
  • Supporting different OS: You can develop and execute ASP.NET apps on Windows, Linux, Docker, and macOS. The Visual Studio provides the tools to build .NET apps with different OS.

4. What is ASP.NET MVC framework?

ASP.MVC is a web application framework that is lightweight and has high testable features. ASP.NET supports 3 different types of components namely Model, View, and Controller.

Model Layer: The Model component corresponds to all or any of the data-related logic that the user works with. This will represent either the info that’s being transferred between the View and Controller components or the other business logic-related data. For instance, a Customer object will retrieve the customer information from the database, manipulate it, and update its data back to the database or use it to render data.

View Layer: The View component is employed for all the UI logic of the appliance. For instance, the Customer view will include all the UI components like text boxes, dropdowns, etc. that the ultimate user interacts with.

Controller: Controllers act as an interface between Model and consider components to process all the business logic and incoming requests, manipulate data using the Model component, and interact with the Views to render the ultimate output. For instance, the Customer controller will handle all the interactions and inputs from the Customer View and update the database using the Customer Model. An equivalent controller is going to be wont to view the Customer data.

5. What is Server control?

ASP.NET has Server Controls features, Which provide facilities to manipulated values of the controls on the Server-Side. This is especially helpful while we want to create validating and dynamically web forms.

6. Which would be the right framework to be used ASP.NET MVC or ASP.NET Web API?

  • ASP.Net MVC is used to make web applications that return the view and data but Asp.Net Web API is used to make all HTTP services in a simple and basic way that returns only information, not view.
  • Web API helps to build REST-ful services over the .NET Framework, and it additionally supports content negotiation, self-facilitating which are not in MVC.
  • Web API additionally deals with returning information specifically design like JSON, XML, or some other dependent on the Accept header in the solicitation, and you don’t stress over that. MVC just returns information in JSON design utilizing Json Result.

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. ASP.NET is open-source. Explain?

ASP.NET is an open-source web framework for building web applications on the .NET (dotNET) framework. It is made by Microsoft and variant 1.0 was delivered in 2002 to allow users to develop dynamic web applications, services, and sites. The framework is designed to work with the standard HTTP convention, which is the standard protocol utilized across all web-based applications. ASP.NET is the replacement to the ASP (Active Server Pages) innovation and was a significant update as far as adaptability and power. It is an expansion of the .NET framework with extra tools and libraries for building things on the web, including web applications and websites. The ASP.NET cross-plate form version is known as ASP.NET Core, which was delivered in 2016. ASP.NET is still updated and supported.

9. Which compiler is used in ASP.NET?

To complied an ASP.NET program .NET framework used the Roslyn compiler.

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. What does “PostBack” mean in ASP.NET?

A PostBack is the process of presenting an ASP.NET page to the server for processing. PostBack is done if certain credentials of the page are to be checked against certain sources, (for example, confirmation of username and secret key/password using a database). This is something that a client machine can not able to achieve and subsequently, these details must be ‘posted back’ on the server. So we can say that a postback event occurs on the client-side but is handled by the code in a copy of the page running on the server.

12. How many types of Server controls are supported by ASP.NET?

There are mainly four different types of Server-side controls in ASP.NET :

  • HTML server controls
  • Web Server controls
  • User controls
  • Validation controls

13. 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.

14. Explain the difference between Web.config and Machine.config file?

There is some key difference between Web.config and Machine.config file below:

  • The machine.config record is the master configuration document on your framework with a lot of default settings.And Web.config is the file for the local settings to be applied for a website which store configuration information in XML format.
  • The settings of Machine.config file are applied to the entire asp.net applications on your server while the settings made in the Web.config file are applied to that specific web application only.
  • Each .NET Framework form has only one machine.config file, simultaneously, each web application has its own web.config file. Directories inside a web application can have web.config files as well.
  • The machine.config is shared values among numerous applications on the server, while Web.config documents contain application explicit things, for example, database connection strings.
  • Suppose if you want any improvements in the web.config, then the web application will promptly load the changes but in the machine.config case you should restart the application.
  • The machine.config document will automatically introduce when you install Visual Studio.Net and it resides in the c:\windows\microsoft.net\framework\version\config folder whereas web.config will automatically be made when you make an ASP.Net web application project.
  • Machine.config is the design configuration file for all the applications in the IIS, but Web. config is a configuration file for a specific application.

15. 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.

16. How to maintain sessions in MVC?

We can maintain sessions in MVC using three different ways:

  • Temp data
  • Viewdata
  • View bag

17. Write down different return types of a controller action method?

  • View Result
  • Javascript Result
  • Redirect Result
  • JSON Result
  • Content Result

18. Explain the differences between GridView and DataGrid?

Grid ViewDataGrid
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 DataGridPerformance is fast as compared to GridView.

19. What is the difference between custom controls and user controls?

User ControlCustom 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.

20. Describe login Controls in ASP?

The ASP.NET supports a robust login controls for web-based application which does not require any program coding. These login controls coordinate with ASP.NET participation and forms 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

21. What is the difference between Web Site and Web Application?

There are following differences between these two :

Web Site

  • In a website, you cannot add multiple projects.
  • There is no project file (.csproj or .vbproj). All the files in a folder structure are automatically included in the site.
  • By default, compilation produces multiple assemblies.
  • The website is easy to create and deploy.
  • You can use different .NET languages on a single web site such as VB.NET pages and C# pages can be used on a single website.
  • You can edit a single page/file after deployment recompilation is not required.
  • Choose a website when one developer will responsible for creating and managing an entire website. Since decoupling is not possible on the website.
  • You cannot establish dependencies on the website.

Web Application

  • In a web application, you can add multiple projects.
  • It has a Visual Studio project file (.csproj or .vbproj) stores information about the project like as the list of files that are included in the project, and any project-to-project references.
  • By default, compilation of code files (excluding .aspx and .ascx files) produces a single assembly.
  • It is easy to develop compared to the website.
  • You cannot use different .NET languages in a Web Application such as
    C# and VB.NET both cannot be used in a web application.
  • You cannot edit a single file. Recompilation is required.
  • The right choice for enterprise environments where multiple developers work for creating, testing and deployment. Different groups work on various components independently like one group work on the domain layer, other work on the UI layer hence, decoupling is possible here
  • You can establish dependencies in a Web Application.

22. What is a round trip?

The trip of a Web page from the client to the server and then back to the client is known as a round trip. In ASP.NET Response.Redirect() causes a round trip.

23. What is a Global.asax file?

The Global.asax file has been derived from the HttpApplication class. The Global.asax file is used to add application-level logic and processing. It does neither handles any UI related processing, nor it does support individual requests. It basically controls the following events.

  • Application_Start
  • Application_End
  • Session_Start
  • Session_End
  • Following are the important aspect of the use of the Global.asax file.
  • The code in the Global.asax is compiled when the web application is built for the first time.
  • Session level code and variables can be declared in Application_Start event.
  • Application level events are for the entire application and may be used for any user.
  • Session level events are user specific for the length of a session.

24. How to define a connection string in Web.config file?

Following is the way to define a connection string in Web.config for SQL Server database.

____________________________________________________________

<connectionStrings>
 <add name="strcon" connectionString="Data Source=DonetApp; Initial Catalog=dotnetDB; Persist Security Info=True; User ID=asif@123; Password=123@asif" providerName="System.Data.SqlClient"/>
 </connectionStrings>
______________________________________________

25. What is the difference between Hyperlink and LinkButton?

Hyperlink control does not have the Click and Command events; whereas the LinkButton control has these events, which can be handled in the code-behind file of the Web page.

26. What are various page events in ASP.NET?

Following are the page level events in ASP.NET.

  • PreInit: This is the first event of a page used to set values such as a master page.
  • Init: This event fires after each control have been initialized. You can use this event to change the initialized value of controls.
  • InitComplete: This event is raised after all initializations of a page and its controls have been completed.
  • PreLoad: This event fires before view state has been loaded for a page and its controls and before page postback processing. This event is useful when you need to write code after the page is initialized.
  • Load(PageLoad): Page load event is generally used to check postback and then sets control properties appropriately. After this event, the load event of child control is called.
  • ControlEvents(Postback): This event is called when a page or its controls causes postback such as ButtonClick event, SelectedIndexChanged event, CheckedChanged events etc.
  • LoadComplete: At this event, all controls are loaded even after additional processing can be done here.
  • PreRender: This event is taking place before view state is saved also it allows final changes to the page or its control.
  • SaveStateComplete: Any changes to the page’s controls at this point are ignored here. This event is useful if you need to write processing that requires the view state to be set.
  • Render: In real it is not an event this is actually a method of a page object and its controls. At this point, controls are rendered in client-side HTML , DHTML, and scripts for the browser.
  • Unload: This event is used to clean up code you can use it to manually release resources.

27. What are navigation controls?

Navigation controls help us to navigate in a Web application easily. These controls store all the links in a hierarchical or drop-down structure; thereby facilitating easy navigation in a Web application.

28. What is the difference between client-side and server-side validations?

Client-side validations work at the client end with the help of scripting languages such as JavaScript or jQuery and VBScript. On the other hand, server-side validations work at the server end with the help of programming languages like C#, VB, F# etc. Server validations work when you submit or send data to the server.

29. How many navigation controls are in ASP.NET?

There are three navigation controls in ASP.NET.

  • SiteMapPath
  • Menu
  • TreeView

30. What are Globalization and Localization?

Globalization is the process of designing and developing an application that functions for multiple cultures or locales. In other words, Globalization is the process of designing and developing an application in such a way that it can be used by users of multiple cultures. Globalization makes your application ready for international markets. This process involves:

  • Identifying the culture and locale that must be supported by the application.
  • Designing features to support those cultures and locales.
  • Writing code that functions equally well with all the supported cultures and locales.
  • Localization is the process of customizing your application for a given culture or locale. In other words, Localization is the process of customizing your application in such a way that it behaves as per current culture or locale. Typically, Localization translates your application UI into current culture or locale.

31. What is a Resource File?

ASP.NET provides resource files to implement globalization and localization. The resource file is an XML file having extension resx. Each resource in the resx file is in the form of a key-value pair. For each culture which your application needs to support create a separate resource file. For example, WebResources.en.resx is a resource file for English language and WebResources.hi.resx is a resource file for the Hindi language.

32. What is Neutral Culture, Culture, and Language?

A neutral culture is a culture that is associated with a language but not with a country or region. For example, “en” for English and in for Hindi. Culture consists of language and the country or region. It is denoted by culture code which contains two lowercase letters denoting the language and two uppercase letters denoting the country or region like as en-US for English in the US, en-GB for UK etc. A language is any spoken language like English (en), Hindi (hi), and German (de) etc.

33. What are Local Resources and Global Resources?

There are two types of resource files as given below :

  • Local Resources: Local resources are specific to a single web page and used for providing versions of a web page in different languages. These are stored in App_LocalResources folder.
  • Global Resources: Global resources are common for the whole web application and can be accessed by all the web pages. These are stored in the App_GlobalResources folder.

34. What are the differences between GridView and DataGrid?

The differences between GridView and DataGrid are given below :

GridViewDataGrid
It was introduced with ASP.NET 2.0It 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 DataGridPerformance is fast as compared to GridView.

35. What are the differences between ListView and Repeater?

The differences between ListView and Repeater are given below :

ListViewRepeater
It was introduced with ASP.NET 3.5It was introduced with ASP.NET 1.0
Built-in supports for paging and sorting.
Need to write custom code.
Built-in supports for Data grouping.Need to write custom code.
Built-in supports for insert update and delete operation.Need to write custom code.
Performance is slow as compared to RepeaterPerformance is fast as compared to ListView

36. What are the different modes for the Session state in ASP.NET?

There are following the different mode of session state which can be defined in a Web.config file.

Off: Specify that Session state is not enabled.

InProc: This is the default mode of the session. In this mode session state is stored on the web server i.e. IIS where an application is running.

OutProc: The OutProc mode can be handled by using the following ways –

  • State Server: In this mode, the session is stored in a separate process called ASP.NET state service. This ensures that the session state will be available if the web application is restarted. This way also makes the session state availability to multiple web servers in a web farm.
  • SQL Server: In this mode, the session is stored in a SQL Server database. This also ensures that the session state will be available if the web application is restarted. This way also makes the session state availability to multiple web servers in a web farm.

Note: Session_End event of Global.asax is fired only in InProc session mode. The object stored in Session state must be serializable if the session mode is set to OutProc.

37. What is the MVC pattern in ASP.NET?

The Model-View-Controller (MVC) represents an architectural pattern that splits an application into 3 key logical components. The names of these components are the model, the view, and the controller. Keep in mind that this pattern is not related to the layered pattern. Essentially, the MVC pattern runs on the software side.

In a particular application that implements the MVC pattern, every component comes with its role dedicated. To understand better, for example, model classes merely hold the data as well as the business logic. These classes don’t deal with the HTTP requests but they view only display information. Moreover, the controllers deal with and respond to user input and determine which model to be passed to which view. Doing this makes an application simple to develop and maintain as it expands in complexity.

38. When to opt for classic ASP.NET over ASP.NET Core?

Although it’s a better choice in nearly all the characteristics, you need not have to switch to ASP.NET Core if you intend to maintain a legacy ASP.NET application that is no longer actively developed. It is better to choose ASP.NET over ASP.NET Core if you:

  • Require a stable environment to work within
  • Don’t require cross-platform support for your Web app
  • Have closer release schedules
  • Are previously continued working on an existing app and expanding its functionality
  • Already owns a team with ASP.NET skills

39. What is the NuGet package manager?

NuGet is a package manager dedicated to the .NET ecosystem. Essentially, Microsoft developed it to offer access to thousands of packages being written by .NET developers. Also, you can use it for sharing the code you already wrote with others.

A classic web application being developed through ASP.NET depends on several open-source NuGet packages to work. One of the famous NuGet package managers is Newtonsoft.Json. It is used for working with JSON data in .NET.

40. What is the advanatges of Asp.Net?

Advantages of ASP.NET

Advantages of ASP.NET

Separation of Code from HTML

To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently.

Support for compiled languages

Developers can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.

Use services provided by the .NET Framework

The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.

Graphical Development Environment

Visual Studio .NET provides a very rich development environment for web developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code but also for HTML and XML.

State management

To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across web farms, and state information can be recovered, even if the server fails or the connection breaks down.

Update files while the server is running

Components of your application can be updated while the server is online and clients are connected. The framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.

XML-Based Configuration Files

Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.

41. What are the different Session state management options available in ASP.NET?

State Management in ASP.NET

A new instance of the Web page class is created each time the page is posted to the server.

In traditional Web programming, all information that is associated with the page, along with the controls on the page, would be lost with each roundtrip.

The Microsoft ASP.NET framework includes several options to help you preserve data on both a per-page basis and an application-wide basis. These options can be broadly divided into the following two categories,

  • Client-Side State Management Options
  • Server-Side State Management Options

Client-Side State Management

Client-based options involve storing information either in the page or on the client computer.

Some client-based state management options are,

  • Hidden fields
  • View state
  • Cookies
  • Query strings

Server-Side State Management

There are situations where you need to store the state information on the server side.

Server-side state management enables you to manage application-related and session-related information on the server.

ASP.NET provides the following options to manage state at the server side:
Application state

  • Session state
  • State Management

42. How can we apply themes in ASP.NET application?

A theme is a collection of settings that define the look of controls and web pages. These themes are applied across all the pages in a web application to maintain a consistent appearance. Themes are included images and skin files; the skin files set the visual properties of ASP.NET controls.

Themes are of two types:

  • Page Theme- A Page theme contains the control skins, style sheets, graphic files, and other resources inside the subfolder of the App_Theme folder in the Solution Explorer window. A page theme is applied to a single page of the web site.
  • Global Theme- A Global theme is a theme that is applied to all the web sites on a web server and includes property settings, and graphics. This theme allows us to maintain all the websites on the same web server and define the same style for all the web pages of the web sites.

43. What is MVC?

Model-View-Controller (MVC) is a pattern to separate an application into the following three main components:

  • Model
  • View
  • Controller

The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating web applications. The ASP.NET MVC Framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentications. The MVC framework is defined in the System.Web.MVC assembly. It provides full control over HTML, JavaScript, and CSS. It’s the better as well as a recommended approach for large-scale applications where various teams are working together.

The ASP.NET MVC framework offers the following advantages,

  • It makes it very easy to manage complexity by dividing an application into the Model, View and Controller.
  • It does not use view state or server-based forms.
  • Full control over HTML, JavaScript, and CSS.
  • It provides better support for Test-Driven Development (TDD).
  • It works well for Web applications that are supported by large teams of developers and for web designers who need a high degree of control over the application behavior.
  • By default support of Facebook and Google Authentication.
  • It easy to manage a large application to divide into multiple areas.

44. What are Cookies in ASP.NET?

Cookies in ASP.NET

Cookies are a State Management Technique that can store the values of control after a post-back. Cookies can store user-specific information on the client’s machine, such as when the user last visited your site. Cookies are also known by many names, such as HTTP Cookies, Browser Cookies, Web Cookies, Session Cookies and so on. Basically cookies are a small text file sent by the web server and saved by the Web Browser on the client’s machine. List of properties containing the HttpCookies Class,

  • Domain: Using these properties we can set the domain of the cookie.
  • Expires: This property sets the Expiration time of the cookies.
  • HasKeys: If the cookies have a subkey then it returns True.
  • Name: Contains the name of the Key.
  • Path: Contains the Virtual Path to be submitted with the Cookies.
  • Secured: If the cookies are to be passed in a secure connection then it only returns True.
  • Value: Contains the value of the cookies.

Limitation of the Cookies

  • The size of cookies is limited to 4096 bytes.
  • A total of 20 cookies can be used in a single website.

45. What is Query String in ASP?

A QueryString is a collection of characters input to a computer or web browser. A Query String is helpful when we want to transfer a value from one page to another. When we need to pass content between the HTML pages or aspx Web Forms in the context of ASP.NET, a Query String is Easy to use and the Query String follows a separating character, usually a Question Mark (?). It is basically used for identifying data appearing after this separating symbol. A Query String Collection is used to retrieve the variable values in the HTTP query string. If we want to transfer a large amount of data then we can’t use the Request.QueryString. Query Strings are also generated by form submission or can be used by a user typing a query into the address bar of the browsers. Syntax of Query String Request.QueryString(variable)[(index).count]

46. What is the use of CheckBox in .NET?

The CheckBox control is a very common control of HTML, unlike radio buttons it can select multiple items on a webpage. The CheckBox control in ASP.NET has many properties and some of them are listed below.

PropertyDescription
AutoPostBackSpecifies whether the form should be posted immediately after the Checked property has changed or not. The default is false.
CausesValidationSpecifies if a page is validated when a Button control is clicked.
CheckedSpecifies whether the check box is checked or not
InputAttributesAttribute names and values used for the Input element for the CheckBox control.
LabelAttributesAttribute names and values used for the Label element for the CheckBox control.
runatSpecifies that the control is a server control. Must be set to “server”
TextThe text next to the check box.
TextAlignOn which side of the check box the text should appear (right or left).
ValidationGroupGroup of controls for which the Checkbox control causes validation when it posts back to the server.
OnCheckedChangedThe name of the function to be executed when the Checked property has changed.

47. What is the concept of Postback in ASP.NET?

PostBack Property in ASP.NET - YouTube
concept of Postback in ASP.NET

Postback is a request which is sent from a client to the server from the same page user is working with. There is an HTTP POST request mechanism in ASP.NET. It posts a complete page back to the server to refresh the whole page.

48.  What is the parent class of all web server control?

________________________

System.Web.UI.Control class
___________________

49. What is the difference between ASP.NET Webforms and ASP.NET MVC?

ASP.NET Webforms uses the page controller approach for rendering layout. In this approach, every page has its controller.

On the other hand, ASP.NET MVC uses the Front Controller approach. In this approach, there is a common controller for all pages.

50. What is the difference between session object and application object?

The session object is used to maintain the session of each user. A session id is generated if a user enters in the application and when the user leaves the application, the session id is automatically deleted.

On the other hand, the application object is used to store the information and access variables from any page in the application.

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x