TOP 10 ASP.NET STATE MANAGEMENT/SESSION INTERVIEW QUESTIONS ANSWERS 5 EXPERIENCED SET-1
ASP.NET STATE MANAGEMENT/SESSION INTERVIEW QUESTIONS ANSWERS 3-5 YEARS EXPERIENCED AS WELL AS FRESHER How to answer the question based ...
How to answer the question based on your experience
as a Fresher or More than 5 Years of exp.:
Here I discuss Asp.net most important/FAQ state management interview questions which can be asked to most experienced(5 years) software engineer (asp.net developer) or it can be asked to a fresher.
But your answers should be according to your experience, A fresher can give the answers as a one-two line statement which he read on the internet/google.
But if you have more then 3 or 5 years of experience, then only your explanatory answer can impress the interviewer.
So this time I decide to post questions related to State Management/Session.
Here are the top 10 questions answers for both experienced and beginners asp.net developers.
Ans: State management is the process by which you maintain state and page information over multiple requests for the same or different pages.
2).Http is stateless, What does this mean?
Ans: Stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of requests and responses.
3).What is Session?
Ans: We know that Http is stateless, means when we open a webpage and fill some information and then move to next page then the data which we have entered will lost.
It happed do to Http protocol stateless nature. So here session come into existence, Session provide us the way of storing data in server memory. So you can store your page data into server
memory and retrieve it back during page postbacks.
4).What are the Advantage and disadvantage of Session?
Session provide us the way of maintain user state/data.
It is very easy to implement.
One big advantage of session is that we can store any kind of object in it. :eg, datatabe, dataset.. etc
By using session we don't need to worry about data collesp, because it store every client data separately.
Session is secure and transparent from the user.
Performance overhead in case of large volumes of data/user, because session data is stored in server memory.
Overhead involved in serializing and de-serializing session data, because in the case of StateServer and SQLServer session modes, we need to serialize the objects before storing them.
5).What is Session ID in Asp.net?
Ans: Asp.Net use 120 bit identifier to track each session. This is secure enough and can't be reverse engineered. When client communicate with server, only session id is transmitted, between them. When client request for data, ASP.NET looks on to session ID and retrieves corresponding data.
6).By default where the sessions ID's are stored ?
Ans: By default, the unique identifier for a session is stored in a non-expiring session cookie in the browser. You can specify that session identifiers not be stored in a cookie by setting the cookieless attribute to true in the sessionState configuration element.
We can also configure our application to store it in the url by specifying a "cookieless" session
The ASP Session cookie has this format:-
7).Where does session stored if cookie is disabled on client’s machine?
The following code example shows a Web.config file that configures session state to use cookieless session identifiers.
8).Can you describe all the property set in web.config under session state?
Cookieless: The cookieless option for ASP.NET is configured with this simple Boolean setting.
Timeout: This option controls the length of time a session is considered valid. The session timeout is a sliding value; on each request the timeout period is set to the current time plus the timeout value
Sqlconnectionstring: The sqlconnectionstring identifies the database connection string that names the database used for mode sqlserver.
Server: In the out-of-process mode stateserver, it names the server that is running the required Windows NT service: ASPState.
Port: The port setting, which accompanies the server setting, identifies the port number that corresponds to the server setting for mode stateserver.
9).What are Session Events?
Ans: There are two types of session events available in ASP.NET:
You can handle both these events in the global.asax file of your web application. When a new session initiates, the session_start event is raised, and the Session_End event raised when a session is abandoned or expires.
10).How you can disable session?
Ans: If we set session Mode="off" in web.config, session will be disabled in the application. For this, we need to configure web.config the following way: