Link to home
Start Free TrialLog in
Avatar of DakotaKat
DakotaKatFlag for United States of America

asked on

Need to Convert JavaScript Session Variable to VB Classic ASP

I need a way to modify the code below so that I can set it via VB with Classic asp. Currently it works with java Script, however users with Java Script Turned off loose the functionality. If I change it to VB and Server Side it should work for those users.

<script type="text/javascript">document.cookie='userLanguage=<%=Session("userLanguage")%>'</script>
Avatar of FreakyEddie
FreakyEddie

You're allready doing so by using Session("userLanguage")

You set it with
Session("userLanguage") = 1043

and

Retrieve it with
strUserLanguage = Session("userLanguage")
Avatar of DakotaKat

ASKER

Is there a way I can write the cookie then with out using JavaScript?
To write the cookie type in your webpage-code:

Session("userLanguage") = 1043 'for USA

Else please post a bit more code or explain a bit more in how you're using it.
I have a language selector that works for everyone with Javascript enabled, but for those who have it turned off they can not write the cookie that is read each time a page it loaded to determine the correct language. Below is the code on the current page.

<% If (Instr(Session("pageLanguages"), "US") > 0) Then %>
            <a title="ENGLISH" style="text-decoration:none" href="<%=Request.ServerVariables("SCRIPT_NAME") & nQueryString%>lang=us">
            <img src="images/flags/en.png" alt="ENGLISH">&nbsp;English</a>
            <script type="text/javascript">document.cookie='userLanguage=<%=Session("userLanguage")%>'</script>

I would like to be able to set that document.cookie value using something serverside if possible. I know it will not solve my problem if they have cookies turned off.
ASKER CERTIFIED SOLUTION
Avatar of FreakyEddie
FreakyEddie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks so much FreakyEddie