Session variable question

  • Thread starter Thread starter RA
  • Start date Start date
R

RA

Hi

If I use session variables does this depends on cookies being sent to the
client browser? If yes then what happens if the user disable cookies?


Thanks
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp12282000.asp
Session configuration
Below is a sample config.web file used to configure the session state
settings for an ASP.NET application:

<configuration>
<sessionstate
mode="inproc"
cookieless="false"
timeout="20"
sqlconnectionstring="data source=127.0.0.1;user id=sa;password="
server="127.0.0.1"
port="42424"
/>
</configuration>
The settings above are used to configure ASP.NET session state. Let's look
at each in more detail and cover the various uses afterward.

a.. Mode. The mode setting supports three options: inproc, sqlserver, and
stateserver. As stated earlier, ASP.NET supports two modes: in process and
out of process. There are also two options for out-of-process state
management: memory based (stateserver), and SQL Server based (sqlserver).
We'll discuss implementing these options shortly.
b.. Cookieless. The cookieless option for ASP.NET is configured with this
simple Boolean setting.
c.. 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
d.. Sqlconnectionstring. The sqlconnectionstring identifies the database
connection string that names the database used for mode sqlserver.
e.. Server. In the out-of-process mode stateserver, it names the server
that is running the required Windows NT service: ASPState.
f.. Port. The port setting, which accompanies the server setting,
identifies the port number that corresponds to the server setting for mode
stateserver.
 
I have found a way to remove the session id in the url and still use
session variables throughout your web application.

In your web.config set the cookieless variable to false and create a
pages tag. See code below:

<pages buffer="true"
enableSessionState="true" />

<sessionState
.... some other code
cookieless="false"
..... some other code
/>

this will make your url look like this : www.mywebsite.com instead of
www.mywebsite.com/(etoczb55dedw1m45pb31ud55)/mypage.aspx and still be
able to use session varialbles in your project.


Good luck!!!
 
Sidd,

The problem with this is that it wont work if the user has cookies disabled!

Try what you mentioned but disable all cookies on your browser... it wont
work!

In a scenario like that, you need to have the session stored in the URL
(cookiless=true)

-ZD

The user's sessionID is stored in a cookie on the browswer so the server
knows which
 
Back
Top