This ASP.NET Tutorial is an extension to my previous tutorial “Top 10 ASP.NET Interview Questions and Answers“. In previous tutorial, focus was to present you with the most important and top ASP.NET Interview Questions that are normally asked during an ASP.NET developer Interview. Here in this article, I’ll try to further extend those important questions as well as add more important questions.
Basically, this is how an interviewer normally does? Interviewer asked a question about a technical concept at high level. If he gets a right answer, he further goes into details related to that particular concept and its implementation details.
For example, in previous article, we asked about the concept of View State in ASP.NET but in this tutorial, we will further explore the View State concept with more questions. But we will not repeat the questions already presented in previous post, so it’s highly recommended to go through that ASP.NET Interview Questions tutorial first.
You can follow other Parts of this ASP.NET Interview Questions Series as:
- ASP.NET Interview Questions – Part 1 (Controls, State Management etc.)
- ASP.NET Interview Questions – Part 2 (Controls, Globalization & Localization etc.)
- ASP.NET Interview Questions – Part 3 (Caching & Security etc.)
- ASP.NET Interview Questions – Part 4 (Security)
- ASP.NET Interview Questions – Part 5 (ASP.NET AJAX)
- ASP.NET Interview Questions – Part 6 (ASP.NET Web API)
What are HttpHandlers and HttpModules in ASP.NET?
In order to fully comprehend the concept of HttpHandlers and HttpModules, I have written a detailed ASP.NET Tutorial. Here I am defining both the concepts as follows:
HttpHandler: ASP.NET Engine uses HttpHandlers to handle specific requests on the basis of it’s extensions. ASP.NET Page Handler handles all requests coming for (.aspx) pages. We can define our own custom HttpHandler to handle a specific request with a specific extension, say .jpeg, .gif, or .ahmad. But there will always be only one handler for a specific request.
What is State Management?
What are the State Management Techniques used in ASP.NET?
State Management techniques used in ASP.NET can be categorized in two types:
- Client-Side State Management
- View State
- Control State
- Hidden Fields
- Query String
- Server-Side State Management
- Application State
- Session State
- Profile Properties
What is ViewState? or Explain ViewState as State Management Technique?
ViewState is one of the Client-Side State Management techniques that provides page-level state management, which means state is preserved between subsequent requests to same page. By using this technique, state of the page along with its controls is stored in a hidden form field i.e. “__VIEWSTATE” and this field is again available on server when page is posted back with HTTP Request.
You can find this hidden field by looking into view source of an .ASPX page as:
ViewState data is encoded in Base64 String encoded format.
Can we Enable/Disable ViewState?
Yes, ViewState can be enabled or disable at different levels:
- Control Level
ViewState for a specific control can be enabled or disabled by setting EnableViewState property as follows:aControl.EnableViewState = false;
- Page Level
We can enable/disable ViewState for a complete page as follows:<%@ Page Language=”C#” EnableViewState=”false” %>
- Application Level
For whole application, we can enable/disable views in configuration file as follows:<pages enableViewState=”false”>
What is the difference between Session.Clear() and Session.Abandon() in ASP.NET?
Session.Clear() clears all the session values but doesn’t destroy the Session. however,
What is the difference between Application and Session State?
Application state is basically a common data repository for an application’s all users and their all sessions. On the other hand, Session state is specific to a single user session.
So, we can store data in application state object that is common for all users of a particular application as follows:
Application["UsersCounter"] = Convert.ToInt32(Application["UsersCounter"]) + 1;
lblUsersCounter.Text = Application["UsersCounter"].ToString();
It’s recommended to store smaller size values in application object.
Session object can store data for a specific session of user. Storage and retrieval is also simple just as for application object.
Session["ProductsCount"] = Convert.ToInt32(Session["ProductsCount"]) + 1;
lblProductsCounter.Text = Session["ProductsCount"].ToString();
Interview Questions about Session State Modes and Session_Start/Session_End events in Global.asax are already explained here.
What is the difference between Label Control and Literal Control?
A Label control in ASP.NET renders text inside <span> tags while a Literal Control renders just the text without any tags.
With Label controls we can easily apply styles using it’s CssClass property, however, if we don’t want to apply style/formatting, it’s better to go for a Literal control.
Hyperlink Vs LinkButton in ASP.NET?
A Hyperlink just redirects to a given URL identified by “NavigateURL” property. However a LinkButton which actually displays a Hyperlink style button causes a postback to the same page but it doesn’t redirect to a given URL.
Validation Controls related Interview Questions are already given in previous post here.
Hopefully, this pool of ASP.NET Interview Questions and Answers along with previous list of Top 10 will be helpful for ASP.NET Developers.
Top 10 Interview Questions and Answers Series:
- Top 10 ASP.NET AJAX Interview Questions
- Top 10 WCF Interview Questions
- Comprehensive Series of WCF Interview Questions
- Top 10 HTML5 Interview Questions
- Top 10 ASP.NET Interview Questions
- Comprehensive Series of ASP.NET Interview Questions
- Top 10 ASP.NET MVC Interview Questions
- Top 10 ASP.NET Web API Interview Questions