Session_Start. Need Help. Thank You.

  • Thread starter Thread starter Shapper
  • Start date Start date
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
 
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
 
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
 
Back
Top