Session_Start. Need Help. Thank You.

S

Shapper

Hello,

On a Session_Start I want to do this:

1. GET "culture" value of a cookie named MyCookie.
NOTE: MyCookie can hold many values.

2. IF MyCookie doesn't exist OR "culture" value doesn't exist THEN

Do Nothing

IF MyCookie exist AND "culture" value exists THEN

Session("culture") = MyCookie("culture")

AND

Change Current Culture (set my web.config) to MyCookie("culture")

I created the following code in Global.asax but it gives me a lot of
errors.
Can someone help me with this?

Sub Session_Start(Sender As Object, E As EventArgs)
Dim MyCookie As HttpCookie = Request.Cookies("MyCookie")
If MyCookie.Values("culture") <> Null
Session("culture") = MyCookie.Values("culture")
Thread.CurrentThread.CurrentCulture = MyCookie.Values("culture")
End If
End Sub

Thank You,
Miguel
 
A

Alvin Bruney [MVP - ASP.NET]

what errors are you having

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
 
S

Shapper

Hi,

I just sorted it out.

Thanks Anyway,
Miguel

what errors are you having

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
Hello,

On a Session_Start I want to do this:

1. GET "culture" value of a cookie named MyCookie.
NOTE: MyCookie can hold many values.

2. IF MyCookie doesn't exist OR "culture" value doesn't exist THEN

Do Nothing

IF MyCookie exist AND "culture" value exists THEN

Session("culture") = MyCookie("culture")

AND

Change Current Culture (set my web.config) to MyCookie("culture")

I created the following code in Global.asax but it gives me a lot of
errors.
Can someone help me with this?

Sub Session_Start(Sender As Object, E As EventArgs)
Dim MyCookie As HttpCookie = Request.Cookies("MyCookie")
If MyCookie.Values("culture") <> Null
Session("culture") = MyCookie.Values("culture")
Thread.CurrentThread.CurrentCulture = MyCookie.Values("culture")
End If
End Sub

Thank You,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top