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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top