Tuesday, June 23, 2009

Asp.Net questions&Ans

What are the parts of the .NET Framework?
.NET Framework has two main parts:
The common language runtime (CLR)
The .NET Framework class library
What are the ways to persistent data in a web application?
Data can be persisted in the web application using any of the following mechanism.
ApplicationState
SessionState
ViewState.
How does classes are organized in the .NET Framework?
The .NET Framework has organized its classes using namespaces.
What is the point to remember about Transfer method in ASP.NET?
Transfer method can't be used with HTML pages. It works only with .aspx pages.
What are the different exception-handling approaches in ASP.NET Web applications?
Exceptions can be handled using any of the following approaches:
Try, Catch, and Finally keywords in VB.NET or the try, catch, and finally keywords in C#.
Error event procedures at the Global, Application, or Page levels.
Describe the purpose of error pages and why they are needed.
Error page is used to trap exceptions occur outside the scope of the application.
The exceptions of these types are identified by HTTP response codes.
These exceptions are handled by IIS by displaying custom error pages listed in your application’s Web.config file.
Explain how tracing helps in handling exceptions.
Tracing helps developer by recording an unusual event while application is running. The developer can trace the unexpected events in the trace log, thus can fix the problem.
Difference between Windows and Forms authentication user lists in Web.config
User lists for Windows authentication are included in the element of Web.config.
User lists for Forms authentications are included in the element of Web.config.
Explain how to require authentication using the Web.config file in ASP.NET.
We can include element to require authentication as shown below:



What is the difference between the Debug and Trace classes?
Code using the Debug class is stripped out of release builds.
Code using the Trace class is left in.
Write a directive to cache responses for a Web form for 30 seconds.
<%@ OutputCache Duration=”30” VaryByParam=”me” %>
Explain how to detect when application data is about to be removed from the cache.
We can detect using onRemoveCallback delegate.
CurrentCulture property vs. Current¬UICulture property.
The CurrentCulture property states how the .NET Framework handles dates, currencies, sorting, and formatting issues.
The CurrentUICulture property determines which satellite assembly is used when loading resources.
What is the purpose of MVC patter?
MVC pattern separates the GUI from the data. It helps in providing multiple views for the same data.
Explain how to enable and disable connnection pooling.
Set pooling = true in the connectionstring. By default, it is true.
Set pooling = false to disable connection pooling.
Dataset.clone vs. Dataset.copy
Dataset.clone copies the structure only whereas dataset copy copies both structure and data.
Explain how to configure WebGarden in ASP.NET.
WebGarden can be configured using process model setting in "machine.config" or "web.config".
What is Webfarm?
Webform consist of two or more web server of same configuration. When any request is made, the router logic of webform decides which web server from the farm handles the request.
Explain the advantages of having webfarm.
Webfarm allows the application to run even if a server is down, since request can be served by other web server of the farm.
What is windows service?
Windows service has the capability to start automatically when the computer boots. It can be manually paused, stopped or even restarted.
Explain how to remove anonymous access to the IIS web application.







How to enable tracing in ASP.NET
Tracing can be enabaled as shown below:
<%@Page Trace = "True"%>
Name the major events in Global.aspx file.
-Application_Init
-Application_Disposed
-Application_Error
-Application_Start
-Application_End
-Application_BeginRequest
-Application_EndRequest
-Application_PreRequestHandlerExecute
-Application_PostRequestHandlerExecute
-Application_PreSendRequestHeaders
-Application_PreSendContent
-Application_AcquireRequestState
-Application_ReleaseRequestState
-Application_ResolveRequestCache
-Application_UpdateRequestCache
-Application_AuthenticateRequest
-Application_AuthorizeRequest
-Session_Start
-Session_End
What are authentication techniques in ASP.NET?
-Windows authentication
-Passport authentication
-Forms authentication
Authentication vs. authorization
-Authentication is varying the identity of the user.
-Authorization is the process of allowing an authenticated user access to resources.
Explain the uses of Global.asax file.
-using this we can set application-level variables
-we can use application-level events.
How many types of validation controls are provided by ASP.NET? Explain them.
There are 6 validation controls in ASP.NET:
1. RequiredFieldValidator: It is for mandatory field.
2. RegularExpressionValidator: It checks the match with a given regularexpression.
3. CompareValidator: It checks that the value in the validated control matches with the value of another control or with a specific value.
4. RangeValidator: It checks the validated control value with a specified range.
5.. CustomValidator: Require to do custom validation on any control after writing required code.
6. ValidationSummary:This control is used to display a summary of all validation errors raised in a particular Web page.
What is impersonation in ASP.NET?
Impersonation is used to decide whether a user request in an ASp.NET application can run under the authenticated identity received from IIS or under a specific identity specified in web.config file when impersonation is enabled.When it is disabled the user request will run under the ASPNET account( the process identity of the application worker process) .By default it is disabled.

or

or

Explain how a web application works.
Answer - A web application resides in the server and serves the client™s requests over internet. The client access the web page using browser from his machine. When a client makes a request, it receives the result in the form of HTML which are interpreted and displayed by the browser.

A web application on the server side runs under the management of Microsoft Internet Information Services (IIS). IIS passes the request received from client to the application. The application returns the requested result in the form of HTML to IIS, which in turn, sends the result to the client.
Application State
Data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.
Session State
Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application's configuration settings. By default, SessionID values are stored in a cookie.
ASP.NET session vs Classic ASP
ASP session variables are recycled when IIS restarts. ASP.NET session is maintained even if IIS reboots.
With ASP session, we can’t have web farms. ASP.NET session supports multiple servers since it can be stored in state server and SQL server.
ASP session is compatible to only those browsers that support cookies.
What is event bubbling?
In ASP.NET, we can have child controls inside server control like Datagrid, Datalist, Repeater. Example, combo box can be placed inside Datagrid. The child can’t raise their events by himself; they send events to their parent which pass to the page as “Itemcommand” event. This processing is called event bubbling.

Copyright © 2009 Angel