如何在会话变量中传递实际字符串并在aso.net中返回相同的字符串 [英] How to pass actual string in session variable and get back same string in aso.net
问题描述
嗨
我需要在会话中存储一个sting并在javascript或jquery中返回相同的sting形式会话变量
例如,我会在会话变量中传递aravind / cad / file这个字符串,需要使用java脚本或jquery返回另一个页面。
什么我做了
服务器端代码是
Dim filepath as string = aravind / cad / file
会话( AfilePath)= filepath
和java脚本我得到这样的
var AfilePath = ' <%= Session( AfilePath)%>'
alert(AfilePath);
ert消息我得到aravind-cad-file,所有/改为 - ,
注意:我不能将 - 转换为/ ,bcz有时字符串包含 - ,例如aravind / cad / file-png,所以这里如果将 - 转换为/则实际字符串会被错误地更改。
我需要加密和解密以传递会话值。
问候
Aravind
HTMLEncode
可以帮到你 - http://msdn.microsoft.com/en-us/library/w3te6wfz(v = vs.110)的.aspx [<一个href =http://msdn.microsoft.com/en-us/library/w3te6wfz(v=vs.110).aspx\"target =_ blanktitle =New Window> ^ ]。
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
Dim filepath as string="aravind/cad/file"
Session("AfilePath") = filepath
and in java script i get like this
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
HTMLEncode
should help you - http://msdn.microsoft.com/en-us/library/w3te6wfz(v=vs.110).aspx[^].
这篇关于如何在会话变量中传递实际字符串并在aso.net中返回相同的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!