Asp.Net Interview Faqs

What’s the difference between Response.Write() andResponse.Output.Write()?

Response.Output.Write() allows you to write formatted output.

What methods are fired during the page load?

Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

When during the page processing cycle is ViewState available?

After the Init() and before the Page_Load(), or OnLoad() for a control.

What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page

Where do you store the information about the user’s locale?

CodeBehind is relevant to Visual Studio.NET only.

What’s the difference between Codebehind="MyCode.aspx.cs"
andSrc="MyCode.aspx.cs"?

CodeBehind is relevant to Visual Studio.NET only.

What is the Global.asax used for?

The Global.asax (including the Global.asax.cs file) is used to implement
application and session level events.

What are the Application_Start and Session_Start subroutines used for?

This is where you can set the specific variables for the Application and
Session objects.

Whats an assembly?

Assemblies are the building blocks of the .NET framework;

Whats MSIL, and why should my developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will
get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the
assembly on the installed computer.

Which method do you invoke on the DataAdapter control to load your generated
dataset with data?

The Fill() method.

Can you edit data in the Repeater control?

No, it just reads the information from its data source.

Which template must you provide, in order to display data in a Repeater control?

ItemTemplate.

Name two properties common in every validation control?

ControlToValidate property and Text property.

What base class do all Web Forms inherit from?

The Page class.

What is the difference between Server.Transfer and Response.Redirect? Why would
I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next
page without making a round-trip back to the client's browser. This provides a
faster response with a little less overhead on the server. Server.Transfer does
not update the clients url history list or current url. Response.Redirect is
used to redirect the user's browser to another page or site. This performas a
trip back to the client where the client's browser is redirected to the new
page. The user's browser history list is updated to reflect the new address

What is ViewState?

ViewState allows the state of objects (serializable) to be stored in a hidden
field on the page. ViewState is transported to the client and back to the
server, and is not stored on the server or any other external source. ViewState
is used the retain the state of server-side objects between postabacks.

What is the lifespan for items stored in ViewState?

Item stored in ViewState exist for the life of the current page. This includes
postbacks (to the same page).

What does the "EnableViewState" property do? Why would I want it on or off?

It allows the page to save the users input on a form across postbacks. It saves
the server-side values for a given control into ViewState, which is stored as a
hidden value on the page before sending the page to the clients browser. When
the page is posted back to the server the server control is recreated with the
state stored in viewstate.

What are the different types of Session state management options available with
ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process
stores the session in memory on the web server. This requires the a
"sticky-server" (or no load-balancing) so that the user is always reconnected
to the same web server. Out-of-Process Session state management stores data in
an external data source. The external data source may be either a SQL Server or
a State Server service. Out-of-Process state management requires that all
objects stored in session are serializable.