Ans. 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.
2. Difference between ASP Session and ASP.NET Session?
Ans. asp.net session supports cookie less session & it can span across multiple servers.
3. What is cookie less session? How it works?
Ans. 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:
4. 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?
Ans. 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
· 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.
5. What method do you use to explicitly kill a users session?
6. What are the different ways you would consider sending data across pages in ASP (i.e between 1.asp to 2.asp)?
Ans. Session public properties
7. What is State Management in .Net and how many ways are there to maintain a state in .Net? What is view state?
Ans. 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:
Hidden Form Fields
Server-Based State Management Options
8. What are the disadvantages of view state / what are the benefits?
Ans. 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.
9. When maintaining session through Sql server, what is the impact of Read and Write operation on Session objects? will performance degrade?
Ans. 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.
10. What are the contents of cookie?
11. How do you create a permanent cookie?
12. What is ViewState? What does the "EnableViewState" property do? Why would I want it on or off?
13. Explain the differences between Server-side and Client-side code?
14. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
15. 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):
16. Briefly describe the role of global.asax?
17. How can u debug your .net application?
18. How do u deploy your asp.net application?
19. Where do we store our connection string in asp.net application?
20. Various steps taken to optimize a web based application (caching, stored procedure etc.)
21. How does ASP.NET framework maps client side events to Server side events.