Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting a signature from the browser
Message
De
25/09/2013 08:33:42
 
 
À
24/09/2013 08:15:17
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01583960
Message ID:
01584080
Vues:
48
>>Seems to me that if you opt for cookieless sessions i.e:
<sessionState cookieless="true">
then when you open a new tab on the browser it will create a new session per tab. Don't know if this can work for you tho.....
>
>I cannot drop the cookie support. Also, with the number of simultaneous users at the same time, we do not want to store session state on the server side.

Using 'cookieless=true' doesn't prevent you from using cookies - just means that the sessionId is in the URL not in a cookie. So if, for example, you wanted to store the user name per session you could use a cookie with the SessionId as the key and 'UserName' as a sub-key. Something like this:
Protected Sub Page_Load(sender As Object, e As EventArgs)
	Dim sessionId As String = Session.SessionID
	Dim thisUserName As String
	Dim thisAge As String

	Response.Write(sessionId)

	Dim cookies = Request.Cookies

	If cookies(sessionId) IsNot Nothing Then
		thisUserName = cookies(sessionId).Values("UserName")
		thisAge = cookies(sessionId).Values("UserAge")
	Else
		thisUserName = UserProvider.GetName()
		'Get UserName from somewhere
		thisAge = UserProvider.GetAge()
		' etc.
		Dim cookie As New HttpCookie(sessionId)
		cookie.Values.Add("UserName", thisUserName)
		cookie.Values.Add("UserAge", thisAge)
		Response.Cookies.Add(cookie)
	End If
	Response.Write(" Name: " & thisUserName)
	Response.Write(" Age: " & thisAge)
End Sub
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform