Tuesday, April 1, 2008

ASP.NET Technical Interview Questions 1

1.Asp.net and asp ? differences?

Code Render Block

Code Declaration Block

Compiled

Request/Response

Event Driven

Object Oriented - Constructors/Destructors, Inheritance, overloading..

Exception Handling - Try, Catch, Finally

Down-level Support

Cultures

User Controls

In-built client side validation

Session - weren't transferable across servers

It can span across servers, It can survive server crashes, can work with browsers that don't support cookies

built on top of the window & IIS, it was always a separate entity & its functionality was limited.

its an integral part of OS under the .net framework. It shares many of the same objects that traditional applications would use, and all .net objects are available for asp.net's consumption.

Garbage Collection

Declare variable with datatype

In built graphics support

Cultures

2.How ASP and ASP.NET page works? Explain about asp.net page life cycle?
**

3.Order of events in an asp.net page? Control Execution Lifecycle?

Phase

What a control needs to do

Method or event to override

Initialize

Initialize settings needed during the lifetime of the incoming Web request.

Init event (OnInit method)

Load view state

At the end of this phase, the ViewState property of a control is automatically populated as described in Maintaining State in a Control. A control can override the default implementation of the LoadViewState method to customize state restoration.

LoadViewState method

Process postback data

Process incoming form data and update properties accordingly.

LoadPostData method (if IPostBackDataHandler is implemented)

Load

Perform actions common to all requests, such as setting up a database query. At this point, server controls in the tree are created and initialized, the state is restored, and form controls reflect client-side data.

Load event

(OnLoad method)

Send postback change notifications

Raise change events in response to state changes between the current and previous postbacks.

RaisePostDataChangedEvent method (if IPostBackDataHandler is implemented)

Handle postback events

Handle the client-side event that caused the postback and raise appropriate events on the server.

RaisePostBackEvent method(if IPostBackEventHandler is implemented)

Prerender

Perform any updates before the output is rendered. Any changes made to the state of the control in the prerender phase can be saved, while changes made in the rendering phase are lost.

PreRender event
(OnPreRender method)

Save state

The ViewState property of a control is automatically persisted to a string object after this stage. This string object is sent to the client and back as a hidden variable. For improving efficiency, a control can override the SaveViewState method to modify the ViewState property.

SaveViewState method

Render

Generate output to be rendered to the client.

Render method

Dispose

Perform any final cleanup before the control is torn down. References to expensive resources such as database connections must be released in this phase.

Dispose method

Unload

Perform any final cleanup before the control is torn down. Control authors generally perform cleanup in Dispose and do not handle this event.

UnLoad event (On UnLoad method)

  1. What are server controls?
    ASP.NET server controls are components that run on the server and encapsulate user-interface and other related functionality. They are used in ASP.NET pages and in ASP.NET code-behind classes.

  2. What is the difference between Web User Control and Web Custom Control?
    Custom Controls

    Web custom controls are compiled components that run on the server and that encapsulate user-interface and other related functionality into reusable packages. They can include all the design-time features of standard ASP.NET server controls, including full support for Visual Studio design features such as the Properties window, the visual designer, and the Toolbox.
    There are several ways that you can create Web custom controls:

    • You can compile a control that combines the functionality of two or more existing controls. For example, if you need a control that encapsulates a button and a text box, you can create it by compiling the existing controls together.

    • If an existing server control almost meets your requirements but lacks some required features, you can customize the control by deriving from it and overriding its properties, methods, and events.

    • If none of the existing Web server controls (or their combinations) meet your requirements, you can create a custom control by deriving from one of the base control classes. These classes provide all the basic functionality of Web server controls, so you can focus on programming the features you need.

    If none of the existing ASP.NET server controls meet the specific requirements of your applications, you can create either a Web user control or a Web custom control that encapsulates the functionality you need. The main difference between the two controls lies in ease of creation vs. ease of use at design time.
    Web user controls
    are easy to make, but they can be less convenient to use in advanced scenarios. You develop Web user controls almost exactly the same way that you develop Web Forms pages. Like Web Forms, user controls can be created in the visual designer, they can be written with code separated from the HTML, and they can handle execution events. However, because Web user controls are compiled dynamically at run time they cannot be added to the Toolbox, and they are represented by a simple placeholder glyph when added to a page. This makes Web user controls harder to use if you are accustomed to full Visual Studio .NET design-time support, including the Properties window and Design view previews. Also, the only way to share the user control between applications is to put a separate copy in each application, which takes more maintenance if you make changes to the control.
    Web custom controls
    are compiled code, which makes them easier to use but more difficult to create; Web custom controls must be authored in code. Once you have created the control, however, you can add it to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP.NET server controls. In addition, you can install a single copy of the Web custom control in the global assembly cache and share it between applications, which makes maintenance easier.

    Web user controls

    Web custom controls

    Easier to create

    Harder to create

    Limited support for consumers who use a visual design tool

    Full visual design tool support for consumers

    A separate copy of the control is required in each application

    Only a single copy of the control is required, in the global assembly cache

    Cannot be added to the Toolbox in Visual Studio

    Can be added to the Toolbox in Visual Studio

    Good for static layout

    Good for dynamic layout


    (Session/State)

  3. Application and Session Events
    The ASP.NET page framework provides ways for you to work with events that can be raised when your application starts or stops or when an individual user's session starts or stops:

    • Application events are raised for all requests to an application. For example, Application_BeginRequest is raised when any Web Forms page or XML Web service in your application is requested. This event allows you to initialize resources that will be used for each request to the application. A corresponding event, Application_EndRequest, provides you with an opportunity to close or otherwise dispose of resources used for the request.

    • Session events are similar to application events (there is a Session_OnStart and a Session_OnEnd event), but are raised with each unique session within the application. A session begins when a user requests a page for the first time from your application and ends either when your application explicitly closes the session or when the session times out.

    You can create handlers for these types of events in the Global.asax file.

  4. Difference between ASP Session and ASP.NET Session?
    asp.net session supports cookie less session & it can span across multiple servers.

  5. What is cookie less session? How it works?
    By default, ASP.NET will store the session state in the same process that processes the request, just as ASP does. If cookies are not available, a session can be tracked by adding a session identifier to the URL. This can be enabled by setting the following:

    http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx

  6. How you will handle session when deploying application in more than a server? Describe session handling in a webfarm, how does it work and what are the limits?
    By default, ASP.NET will store the session state in the same process that processes the request, just as ASP does. Additionally, ASP.NET can store session data in an external process, which can even reside on another machine. To enable this feature:

    • Start the ASP.NET state service, either using the Services snap-in or by executing "net start aspnet_state" on the command line. The state service will by default listen on port 42424. To change the port, modify the registry key for the service: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\Port

    • Set the mode attribute of the section to "StateServer".

    • Configure the stateConnectionString attribute with the values of the machine on which you started aspnet_state.

    The following sample assumes that the state service is running on the same machine as the Web server ("localhost") and uses the default port (42424):

    Note that if you try the sample above with this setting, you can reset the Web server (enter iisreset on the command line) and the session state value will persist.
    **

  7. What method do you use to explicitly kill a users session?
    Abandon()

  8. What are the different ways you would consider sending data across pages in ASP (i.e between 1.asp to 2.asp)?
    Session
    public properties

  9. What is State Management in .Net and how many ways are there to maintain a state in .Net? What is view state?
    Web pages are recreated each time the page is posted to the server. In traditional Web programming, this would ordinarily mean that all information associated with the page and the controls on the page would be lost with each round trip.
    To overcome this inherent limitation of traditional Web programming, the ASP.NET page framework includes various options to help you preserve changes ? that is, for managing state. The page framework includes a facility called view state that automatically preserves property values of the page and all the controls on it between round trips.
    However, you will probably also have application-specific values that you want to preserve. To do so, you can use one of the state management options.
    Client-Based State Management Options:
    View State
    Hidden Form Fields
    Cookies
    Query Strings
    Server-Based State Management Options
    Application State
    Session State
    Database Support

  10. What are the disadvantages of view state / what are the benefits?
    Automatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). This feature does impact performance, however, since a server control's view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your page's performance.

  11. When maintaining session through Sql server, what is the impact of Read and Write operation on Session objects? will performance degrade?
    Maintaining state using database technology is a common practice when storing user-specific information where the information store is large. Database storage is particularly useful for maintaining long-term state or state that must be preserved even if the server must be restarted.
    **

  12. What are the contents of cookie?
    **

  13. How do you create a permanent cookie?
    **

  14. What is ViewState? What does the "EnableViewState" property do? Why would I want it on or off?
    **

  15. Explain the differences between Server-side and Client-side code?
    Server side code will process at server side & it will send the result to client. Client side code (javascript) will execute only at client side.

  16. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
    **

  17. Which ASP.NET configuration options are supported in the ASP.NET implementation on the shared web hosting platform?
    A: Many of the ASP.NET configuration options are not configurable at the site, application or subdirectory level on the shared hosting platform. Certain options can affect the security, performance and stability of the server and, therefore cannot be changed. The following settings are the only ones that can be changed in your site?s web.config file (s):
    browserCaps
    clientTarget
    pages
    customErrors
    globalization
    authorization
    authentication
    webControls
    webServices

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetconfiguration.asp

  18. Briefly describe the role of global.asax?

  19. How can u debug your .net application?

  20. How do u deploy your asp.net application?

  21. Where do we store our connection string in asp.net application?

  22. Various steps taken to optimize a web based application (caching, stored procedure etc.)

  23. How does ASP.NET framework maps client side events to Server side events.

    (Security)

  24. Security types in ASP/ASP.NET? Different Authentication modes?

  25. How .Net has implemented security for web applications?

  26. How to do Forms authentication in asp.net?

  27. Explain authentication levels in .net ?

  28. Explain autherization levels in .net ?

  29. What is Role-Based security?
    A role is a named set of principals that have the same privileges with respect to security (such as a teller or a manager). A principal can be a member of one or more roles. Therefore, applications can use role membership to determine whether a principal is authorized to perform a requested action.
    **

  30. How will you do windows authentication and what is the namespace? If a user is logged under integrated windows authentication mode, but he is still not able to logon, what might be the possible cause for this? In ASP.Net application how do you find the name of the logged in person under windows authentication?

  31. What are the different authentication modes in the .NET environment?

    ="WindowsFormsPassportNone">   ="name"
    loginUrl="url"
    protection="AllNoneEncryptionValidation"
    timeout="30" path="/" >
    requireSSL="truefalse"
    slidingExpiration="truefalse">
    ="ClearSHA1MD5"> ="username" password="password"/> internal"/>
Free download online recent and current year solved placement question papers 2008 of leading companies in India and Abroad. See More Latest and previous expert, common, basic, important, advanced questions asked in college admission, entrance tests and technical interviews for 2007, 2008. Group Discussion GD guide with topics for leading campus placement interview, placement drive, HR Interview Guide with Questions and answers, how to behave, Tips, preparation, most recently asked / important software testing interview, free tutorials for java, oracle, c, c++, networking, web designing, windows 2000, etc. questions. Keep Watching Previouspapers.blogspot.com for more stuff!
 

No comments: