Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problem with AJAX, Application_AcquireRequestState and session

$
0
0

Hi everybody!

I've got a 3.5 site where I'm adding a second language implemented with resources. I've got buttons on the master page for setting a session variable with the language and in Application_AquireRequestState is the following code:

Sub Application_AcquireRequestState(ByVal sender As Object, ByVal e As EventArgs)
        Dim l As String = ""
        If System.Web.HttpContext.Current.Session("lang") Is Nothing Then
            l = "fi-FI"
        ElseIf CStr(System.Web.HttpContext.Current.Session("lang")) = "sv-FI" Then
            l = "sv-FI"
        Else
            l = "fi-FI"
        End If

        Dim ci As New System.Globalization.CultureInfo(l)
        System.Threading.Thread.CurrentThread.CurrentCulture = ci
        System.Threading.Thread.CurrentThread.CurrentUICulture = ci
End Sub

The problem is that the above code somehow doesn't work with AJAX. My AJAX pages get the "'Sys' is not defined" error. It doesn't throw a runtime error, it's just the AJAX functionality that won't work. When I comment out the above code the AJAX is working, but I can't switch languages on the fly. Any suggestions on how to solve this?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>