advantages of Session State
Session in asp.net & Advantages of Session:
In this post we describe advantages and disadvantages of session management. And also Explain how to make and use session in asp.net page.
The advantages of using Session State
- Better security
- Reduced bandwidth
The disadvantages of using Session state are
- More resource consumption of server.
- Extra code/care if a Web farm is used.
Using Session State in asp.net:
ASP.NET allows us to save values using Session state.
It is a global storage mechanism that is accessible from all pages in the Web
application. Session state is stored in the Session key/value dictionary.
This information will be user specific i.e. for each user separate dictionary
will be created and no one can access other session information. Below is the
Example usage of sessions.
// write in global.asax
void Session_Start(object sender, EventArgs e)
{
// Code that runs
when a new session is started
Session["number"]
= 0;
}
// write in Web forms
Session["number"] = Convert.ToInt32(Session["number"])
+ 1;
Label6.Text = Session["number"].ToString();
Enumerating Session Management Techniques:
Before we proceed, let us see what all session management
techniques are present in the ASP.NET framework.
- In-Proc.
- SQLServer.
- StateServer.
Configure Sessions in asp.net:
To configure the session management we need to specify the
settings in the web.config file. Typical settings in web.config looks
like:
<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="Data
Source=.\SQLEXPRESS;Trusted_Connection=Yes;"
cookieless="false"
timeout="100"/>
Now see what each of these attributes mean:
We explain all terms here.
Mode:
This
specifies the type of session management we want to use. It could be InProc,
SQL Server, and State Server.
If we use State Server as session management technique then
this specifies the location of the server that is handling the session data.
sqlConnectionString:
If we use SQL Server as session management technique then
this specifies the database connection string that will store the session data.
cookieless:
This
specifies whether we will be using cookies to identify sessions or we want
session info appended in URL. It could be true or false.
timeout :
This specifies the time for which the session should be
active. After this much time of inactivity the session will expire.
Checkboxlist related other post on asp.net tutorial.
- Validation checkbox control using JavaScript
- Asp-checkboxlist control demo:
- Asp checkboxlist Example using C#
- Checkboxlist in asp.net(control example)
- Example jQuery Validate on CheckBoxList using C#
- Check Uncheck all html CheckBoxlist controls using jQuery:
- Check Uncheck all asp.net CheckBox in asp.net using jQuery
- Ckeck box list example using javascript.
- Asp.net checkboxlist control example
- How to use CheckBox control in asp.net
- How to check If checkbox Is checked in asp.net
- Validation checkbox control using JavaScript:
- Checkbox list Example using javascript
- Checkboxlist control in asp net
- Asp.net Checkbox List.
- Asp.net CheckBoxList using jQuery
- Get Asp.net CheckBoxList control values using Jqury
Comments
Post a Comment