Wednesday, September 19, 2012

What is a Web Application - Interview Questions

A web application is any application that uses a web browser as a client. The application can be as simple as a message board or a guest sign-in book on a website, or as complex as a word processor or a spreadsheet

A web application is a dynamic extension of a web or application server. There are two types of web applications:

Presentation-oriented: Web application

A presentation-oriented web application generates interactive web pages containing various types of markup language (HTML, XML, and so on) and dynamic content in response to requests.

Service-oriented: Web application

A service-oriented web application implements the endpoint of a web service. Presentation-oriented applications are often clients of service-oriented web applications.

Web Development Company

What is ASP.NET - Asp.net Interview Questions


  • ASP.NET is a Web application framework marketed by Microsoft that can be used to build dynamic Web sites, Web applications, and XML Web services.
  • It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology.
  • Applications developed using ASP.NET must be hosted on an Internet Information Services (IIS) server.

How ASP .NET different from ASP - Asp.net Interview Questions

Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server.

Process Isolation
ASP is run under the inetinfo.exe(IIS) process space and hence susceptible to application crashes as a result the IIS needs to be stopped or restarted. ASP is related to the process isolation setting in IIS.

But, ASP.Net The ASP.NET worker process is a distinct worker process, aspnet_wp.exe, separate from inetinfo.exe ( IIS process), and the process model in ASP.NET is unrelated to process isolation settings in IIS.

Multi Language Support in WebPage
In ASP only two languages were available for scripting VBScript and Jscript/Javascript.

But in ASP.NET We are no longer constrained to the two scripting languages available in traditional ASP: Any fully compliant .NET language can now be used with ASP.NET, including C# and VB.NET.

Note :- (C# and VB.Net are both server Side languages.) 

Interpretation Vs Compilation
In ASP, ASP engine executes server-side code, which is always through an interpreter (JScript or VBScript). When a traditional ASP page is requested, the text of that page is parsed linearly. All content that is not server-side script is rendered as is back to the response. All server-side script in the page is first run through the appropriate interpreter (JScript or VBScript), the output of which is then rendered back to the response. This architecture affects the efficiency of page rendering in several ways. First, interpreting the server-side script on the fly.As a side effect, one common optimization for ASP applications is to move a lot of server-side script into precompiled COM components to improve response times. A second efficiency concern is that intermingling server-side evaluation blocks with static HTML is less efficient than evaluating a single server-side script block, because the interpreter has to be invoked over and over again. Thus, to improve efficiency of rendering, many ASP developers resort to large blocks of server-side script, replacing static HTML elements with Response.Write() invocations instead. Finally, this ASP model actually allows different blocks of script within a page to be written in different script languages. While this may be appealing in some ways, it also degrades performance by requiring that a particular page load both scripting engines to process a request, which takes more time and memory than using just one language.

But in ASP.NET, In contrast, ASP.NET pages are always compiled into .NET classes housed within assemblies. This class includes all of the server-side code and the static HTML, so once a page is accessed for the first time (or any page within a particular directory is accessed), subsequent rendering of that page is serviced by executing compiled code. This eliminates all the inefficiencies of the scripting model of traditional ASP. There is no longer any performance difference between compiled components and server-side code embedded within a page they are now both compiled components. There is also no performance difference between interspersing server-side code blocks among static HTML elements, and writing large blocks of server-side code and using Response.Write() for static HTML content. Also, because the .aspx file is parsed into a single code file and compiled, it is not possible to use multiple server-side languages within a single .aspx file.

What are the advantage of Asp.net

ASP.NET provides the following advantages:
  • Enables you to access information from data sources, such as back-end databases and text files that are stored on a Web server.
  • Provides enriched tool support in the form of Visual Studio .NET integrated development environment (VS .NET IDE).
  • Enables you to develop your application in any .NET language.
  • Enables you to build user interfaces that separate application logic from presentation content.
  • Enables you to manage Web applications by storing the configuration information in an XML file.
  • Helps improve developer productivity and provides facilities for improving the performance, reliability, and scalability of Web applications.

Tuesday, September 18, 2012

What is the main difference between an ASP.NET Web application and a traditional Windows application

ASP.NET Web applications runs under common language runtime using managed code where as Unmanaged Windows application runs under Windows using unmanaged code.

List the four major differences between Web and Windows applications.

  • Web forms cannot use the standard Windows controls. Instead, they use server controls, HTML controls, user controls, or custom controls created specially for Web forms.
  • Web applications are displayed in a browser. Windows applications display their own windows and have more control over how those windows are displayed.
  • Web forms are instantiated on the server, sent to the browser, and destroyed immediately. Windows forms are instantiated, exist for as long as needed, and are destroyed.
  • Web applications run on a server and are displayed remotely on clients. Windows applications run on the same machine they are displayed on.

Explain the life cycle of an ASP .NET page

ASP.NET 2.0 Page Life Cycle - The lifetime of an ASP.NET page is filled with events. A .NET technical interview might begin with this question. A series of processing steps takes place during this page life cycle. Following tasks are performed:
  • Initialization
  • Instantiation of controls
  • Restoration & Maintainance of State
  • Running Event Handlers
  • Rendering of data to the browser
The life cycle may be broken down into Stages and Events. The stages reflect the broad spectrum of tasks performed. The following stages take place
  1. Page Request - This is the first stage, before the page life cycle starts. Whenever a page is requested, ASP.NET detects whether the page is to be requested, parsed and compiled or whether the page can be cached from the system.
  2. Start - In this stage, properties such as Request and Response are set. Its also determined at this stage whether the request is a new request or old, and thus it sets the IsPostBack property in the Start stage of the page life cycle.
  3. Page Initialization - Each control of the page is assigned a unique identification ID. If there are themes, they are applied. Note that during the Page Initialization stage, neither postback data is loaded, nor any viewstate data is retrieved.
  4. Load - If current request is a postback, then control values are retrieved from their viewstate.
  5. Validation - The validate method of the validation controls is invoked. This sets the IsValid property of the validation control.
  6. PostBack Event Handling - Event handlers are invoked, in case the request is a postback.
  7. Rendering - Viewstate for the page is saved. Then render method for each control is called. A textwriter writes the output of the rendering stage to the output stream of the page's Response property.
  8. Unload - This is the last stage in the page life cycle stages. It is invoked when the page is completely rendered. Page properties like Respone and Request are unloaded.

what is application state in asp.net

ASP.NET allows you to save values using application state, a global storage mechanism that is accessible from all pages in the Web application. Application state is stored in the Application key/value dictionary. Once you add your application-specific information to application state, the server manages it, and it is never exposed to the client. Application state is a great place to store information that is not user-specific. By storing it in the application state, all pages can access data from a single location in memory, rather than keeping separate copies of the data. Data stored in the Application object is not permanent and is lost any time the application is restarted.
ASP.NET provides three events that enable you to initialize Application variables (free resources when the application shuts down) and respond to Application errors:

a.Application_Start: Raised when the application starts. This is the perfect place to initialize Application variables.

b.Application_End: Raised when an application shuts down. Use this to free application resources and perform logging.

c.Application_Error: Raised when an unhandled error occurs. Use this to perform error logging.

Example :

// This sets the value of the Application Variable



Application["Name"] = txtName.Text; 

Response.Redirect("WebForm5.aspx"); 



// This is how we retrieve the value of the Application Variable



if( Application["Name"] != null ) 

    Label3.Text = Application["Name"].ToString();