General discussion

Locked

Session Variable

By sp_bannore ·
Hello Everyone,
I want to store the value in session variable But this is not working at the
Server side.I am not able to access this
value in the vb code Plz suggest me what i can do for this?
Otherwise what could be the other reasons that this value is not getting stored in the session variable


<script language=javascript>
function abc()
{
var a=1;
session("Swati")=a;
}

</script>

Swati Jain

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Y2KSUNDARA In reply to Session Variable

HI u cannot access server side session variable in javascript. you need to access it in codebehind vb code

Collapse -

by StreamLogic In reply to Session Variable

Swati,

As previously answered, you cannot access server-side objects via client-side code. However, here is an alternative solution that may help you:

Within your Javascript code, use the XMLHTTP object to asyncronously POST to an ASP/ASPX page, maybe called p_setsessions.asp. Within this POST you can set the data to send and send the session variable name and the JS value.

This .asp page would then take these params, set the session variable, and then return to your client-side JS code.

I would be happy to share some example code if you would like. Pls. email me.

Curtis
StreamLogic Inc.
www.streamlogicinc.com

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums