DakotaKat
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">doc ument.cook ie='userLa nguage=<%= Session("u serLanguag e")%>'</sc ript>
<script type="text/javascript">doc
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.
Session("userLanguage") = 1043 'for USA
Else please post a bit more code or explain a bit more in how you're using it.
ASKER
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("pageLangua ges"), "US") > 0) Then %>
<a title="ENGLISH" style="text-decoration:non e" href="<%=Request.ServerVar iables("SC RIPT_NAME" ) & nQueryString%>lang=us">
<img src="images/flags/en.png" alt="ENGLISH"> Englis h</a>
<script type="text/javascript">doc ument.cook ie='userLa nguage=<%= Session("u serLanguag e")%>'</sc ript>
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.
<% If (Instr(Session("pageLangua
<a title="ENGLISH" style="text-decoration:non
<img src="images/flags/en.png" alt="ENGLISH"> Englis
<script type="text/javascript">doc
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks so much FreakyEddie
You set it with
Session("userLanguage") = 1043
and
Retrieve it with
strUserLanguage = Session("userLanguage")