session updates too slow
Hi again,
I have a puzzling experience with a flag (English/Swedish) that I use for letting the user choose language of the web site. For some reason the page does refresh but the language settings aren't updated the first time the flag is clicked, but after that, it's updated every time. I guessed it had to do with EnableViewState or so, but I can't spot the error. Please help me out if you spot this silly error that's driving me crazy.
The sub for changing the session (and cookie too):
Protected Sub FlaggaImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles FlaggaImageButton.Click
If FlaggaImageButton.ImageUrl = "img/unionjack.gif" Then Session("lang") = "en"
If FlaggaImageButton.ImageUrl = "img/gulbla.gif" Then Session("lang") = "sv"
Dim c As New System.Web.HttpCookie("langcookie", Session("lang"))
c.Expires = Now.AddDays(10000)
Response.Cookies.Add(c)
End Sub
The ImageButton itself:
<asp:ImageButton ID="FlaggaImageButton" runat="server" Style="z-index: 108; left: 830px; top: 120px; position: absolute;" />
The PageLoad's first lines:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Request.Cookies("langcookie") Is Nothing Then Session("lang") = Request.Cookies("langcookie").Value
If Request.Cookies("langcookie") Is Nothing And Session("lang") Is Nothing Then Session("lang") = "sv"
If Session("lang") = "sv" Then
TaglineImage.ImageUrl = "img/tagline_sv.gif"
HemsokLabel.Text = "<a href=""Default.aspx"">Hem/Sök</a>"
HemsokLabel.ToolTip = "Till startsidan/Sök i katalogen"
etc.
Thanks in advance!
Pettrer
Coding is indeed a nine-to-five job; nine pm to five am.
__________________
Coding is indeed a nine-to-five job; nine pm to five am.
|