Click here to Skip to main content
15,868,306 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I need to store one sting in session and get back same sting form session variable in javascript or jquery

For e.g i will pass "aravind/cad/file" this string in session variable and need to get back in another page using java script or jquery.

What i did

in server side code is
VB
Dim  filepath as string="aravind/cad/file"
Session("AfilePath") = filepath


and in java script i get like this

JavaScript
var AfilePath ='<%=Session("AfilePath")%>'
alert(AfilePath);


In alert message what i get "aravind-cad-file",all "/" change to "-",

Note: i cant convert "-" to "/" ,bcz sometime string contain "-" ,e.g "aravind/cad/file-png",so here if convert "-" to "/" then actual string is changed wrongly.

I need encrypt and decrypt for passing session values.


Regards
Aravind
Posted
Updated 21-Dec-14 21:06pm
v3
Comments
Kornfeld Eliyahu Peter 22-Dec-14 2:05am    
You have to check your code - this is not happening by its own! You have somewhere some code that replaces / to -. Find it...
Aravindba 22-Dec-14 2:12am    
Thank you ur reply, i am not replace "-" to "/" in any place,just u check yourself,in one page server side pass "daf/afs/ca" this sting in session variable and try to get session value in client side using jquery or JavaScript,i think before pass need to encrypt and receive time decrypt values,How to decrypt value in server side and how to encrypt session value in client side using javascript.
Kornfeld Eliyahu Peter 22-Dec-14 2:18am    
I checked it several times - no change of the string! That's the reason I tell you to search your code...
Aravindba 22-Dec-14 2:42am    
pls use stings like "dsfsd/dsfasd/dfsf" bcz,how u cant pass url link to other page in asp.net same like this behave,for that need to encrypt and dycrypt url link.
Sinisa Hajnal 22-Dec-14 2:53am    
You're not listening...it is your code, nothing automagical.

Try setting the variable from the server. Write the function setMyVariable(value) and then call RegisterStartupScript calling the function with your session variable as the value.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900