Thursday, 10 April 2014

What Interviewer asks to ASP.NET Beginners and Professionals?

In this tutorial, we are going to focus on essential and questions that generally ask by interviewer at the time of ASP.NET developer Interview. To make easy for job seeker, here we have listed 10 important questions. Hope it will work for you.


What HttpHandlers and HttpModules mean in ASP.NET?

HttpHandler is used by ASP.NET Engine that handles particular requests that based on its extensions. All requests coming for (.aspx) pages are handled by ASP.NET Page. It simply handles a specific request with a specific extension. But, there will be only one handler for particular request.

HttpModule is used by ASP.NET Engine for injecting some specific functionality with ASP.NET default functionality for all incoming requests despite its extensions. No doubt, number of built-in modules is available in ASP.NET HTTP Pipeline. However, writing custom HTTP module for performing some additional functionality for all incoming requests is one of the best alternatives.

What State Management means?

By nature, HTTP is a stateless protocol and thus, it requires protecting state between subsequent requests to server from one or more clients. And this mechanism is referred as State Management.

What are the State Management Techniques used in ASP.NET?

It can be divided into two types:

Client-Side State Management

  • View State
  • Control State
  • Hidden Fields
  • Cookies
  • Query String

Server-Side State Management

  • Application State
  • Session State
  • Profile Properties

Meaning of ViewState? OR Explain ViewState as State Management Technique.

One of the Client-Side State Management techniques, ViewState delivers page-level state management which means state is preserved subsequent requests to same page. Implementing this technique, one can simply store state of the page along with its controls in a hidden form field i.e. "__VIEWSTATE" and this field is again accessible on server when page is posted back with HTTP Request.

Looking into view source, you can easily find this hidden field as:<input type="hidden" name="__VIEWSTATE" value="wEPDwUKMTM4OTIxNTEzNA9kFgJmD2QWAgIBD2QWAgIDDxYCHgVzdHlsZQV" />

Its data is encoded in Base64 String encoded format.

Can ViewState be Enable/Disable?

Yes. It can be enabled or disables at different points:

Control Level

One can easily create specific control by setting EnableViewState property as follows:

Control.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">
....
</pages>

How Session.Clear() is differ from Session.Abandon() in ASP.NET?

Session is a collection that stores data as Key/Value pair and thus, all the session values are cleared by Session.Clear() but doesn’t destroy the Session. However, the session object are destroyed by Session.Abandon(). We can also say that Session.Clear() is like removing all files that available inside the folder but Session.Abandon() means removing the "Root" folder.

What is the difference between Application and Session State?

Basically, application state is a common data repository for an application's all users and their all sessions. Moreover, session start is particular to a single user session. So, one can easily store data in application state object that is common for all users of a particular application as follows:

//Set Value
Application["UsersCounter"] = Convert.ToInt32(Application["UsersCounter"]) + 1;
//Retrieve Value
lblUsersCounter.Text = Application["UsersCounter"].ToString();
It is advisable to store small size values in application object. Session object can store data for particular session of user. Furthermore storage and retrieval is also simple for application object.
//Set Value
Session["ProductsCount"] = Convert.ToInt32(Session["ProductsCount"]) + 1;
//Retrieve Value
lblProductsCounter.Text = Session["ProductsCount"].ToString();

How Label Control and Literal Control are different?

A text inside <span> tags is rendered by a Label control in ASP.NET while just the text without any tags is rendered by a Literal Control. One can easily apply application styles by using its CssClass property with Label controls. However, it is better to go for a Literal control, if we don't want to apply style/formatting.

Hyperlink Vs LinkButton in ASP.NET

NavigateURL" property identifies hyperlink that just redirects to a given URL. However, through a LinkButton, one can easily shows a Hyperlink style button that causes a postback to the same page but it doesn't redirect to a given URL.

These are some questions interviewer asking while taking interview. If you have some more questions in your mind related to Asp.net website Development then feel free to ask.

Moreover, if you are looking to hire Asp.net Developer from reliable development company, then Contact.

No comments:

Post a Comment