By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,829 Members | 1,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,829 IT Pros & Developers. It's quick & easy.

Could someone test this? It's driving me crazy.

P: n/a

I have this code in Global.asax:

Sub Session_Start(Sender As Object, E As EventArgs)

Dim cookie As HttpCookie = Request.Cookies("MyCookie")
If Not cookie Is Nothing Then
Response.Write(" * Cookie Exists * ")
If Not cookie.Values("culture") Is Nothing
Response.Write(" * Value Culture Exists Inside Cookie *
Session("culture") = cookie.Values("culture")
Thread.CurrentThread.CurrentCulture = New
Response.Write(" * Value Culture Doesn't Exist Inside
Cookie* ")
cookie.Values.Add("culture", "pt-PT")
End If
Response.Write(" * Cookie Doesn't Exist * ")
Dim newCookie As HttpCookie = New
newCookie.Values.Add("culture", "pt-PT")
newCookie.Expires = #01/01/3000#
End If

End Sub

Basicly this shoud work this way:

IF Cookie Exists AND Cookie Value "Culture" Exists THEN

Session("culture") = ...

IF Cookie Exists AND Cookie Value "Culture" Doesn't Exist THEN

Add Culture Value to the existing Cookie.
(NOTE: Cookie have many other values. Culture Values must be
added to the existing ones.)

IF Cookie Doesn't Exist THEN

Create Cookie and place a "culture" value inside it.
Of course I want this code to run when a new session starts.

The code works but strange things happen like:
No Cookie is created.
When Culture value is added to cookie all the other disappear.

This is driving me crazy. I am on this for hours.
Could someone please check it out?
I added Response.Write commands to help following what is going on.

Maybe something stange going on with my OS....I don't know.

Thank You,

Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.