Session Management Interview questions in asp.net
Q) What is session state? (Session Management Interview questions -1)
Q) What is session state? (Session Management Interview questions -1)
Since
HTTP is a stateless protocol , the server treat each request as a new
request that is ,it will not hold any previous request state . In
order to hold values like user details , browser data etc we have
session .
Q)
What are the alternatives of session states ? (Session
Management Interview questions -2)
- Application state : Stores data in memory which is accessible to all users.
- Profile Properties : It persists user data without expiring it.
- ASP.Net Caching : Stored data in memory which is available to all Web Applications.
- view state : Keeps values in web page.
- Cookies : Keeps data in browser cache.
- The query string and fields on html That are available on request
Q)
What is application state ? (Session Management Interview
questions -3)
Application
state is the data-storage space which is available for all classes in
ASP.NET application . Application state is stored in memory on
server and is faster than the data stored in databases. Application
state is available for all users where as the session state is specific for a given user. We can store small amount of information which is applicable to all users in your .net application .
Application
state stored data in a instance of “HttpApplicationState”
class.It is a keyvalue dictionary objects .Instance is created firs-time a user access any page in your application .
Q)
What are the modes of session state available in asp.net ?
(Session Management Interview questions -4)
Inproc
Mode : Thuis is the default mode of session storage .The data is
stored on the server .
State
server Mode: Stores session state in separate services called ASP.NET
State service. The session state preserves even if the application is
restarted or application pool recycled .We can also available session
state in multiple state servers or web farms
SQL
Server Mode : The session state is saved in SQL server database.
Custom
Mode : Enables you to points a custom storage provider .
Off
Mode : Which dissables session state.
Q)
What is state server mode and how will it works? (Session
Management Interview questions -5)
In
State server mode the session state is stored in a process called
ASP.NET state service.It is separate from ASP.NET worker process or
IIS application pools . The session state is stored in multiple web
servers in a web farm.To use the state server mode , we need to configure it in Web config file.
Q)
What is the default session time out ? (Session Management
Interview questions -6)
The
default session timeout is 20 minutes. That is if a user is idle for
mor than 20 minutes then the session will be expires . How ever we can
modify the session time out time up to a maximum of 526601 minutes (1
year ) for In-Process and state server mode.
Q)
What
are Session variables ?
(Session Management Interview questions -7)
Session
variables are stored in a “sessionstaeItemCollection” object .
That is exposed through the HttpContext.Session property. The
session variables can be any valid datatype. The session variable
collections are indexed by name or its integer index. Can be accedes by referring its name.
Session[“FirstName”]=”test”
Q)
What are Session identifiers? (Session Management Interview
questions -8)
Sessions
are identified by a unique identifier that can be get by using the
“SessionID” Property. For a session state enabled application ,
each request is send from browser will be cheched for a sessionid. If
the sessionid is not there then , ASP.Net creates a new session and
pass the sessionid to the browser along with response. The sessionid
saved in cookie by default , we can also configure the application
to store sessionid in querystring in case of “cookieless” session
.
Q)
What is coockieless session ? (Session Management Interview
questions -9)
The
sessionids are stored in cookies in the browser . But we can also
configure that the sessionid should not be saved in cookie in the
browser by setting the “Cookieless” attribute to “true” in
the session-state section of the Web.config file. ASP.Net manages the
sessionid in cookie-less session state by inserting the sessionid with
in the URL .
No comments:
Post a Comment