使用javascript进行设置会话 [英] settings session using javascript
问题描述
大家好,
你能帮我么?我已经工作了几天,但无法解决.我有 Dropdownlist ,是否有可能每次我选择dropdownlist都会通过javascript创建会话.在下拉列表中选择项目后,它将覆盖当前值.没有按钮干预..那有可能吗?请帮助..我正在使用 MVC3(c#).请指导我..谢谢.
问候,
-naijeru-
var myvar =嘿好友"; '<%会话[" ] = " ; %> '; alert('<% = Session [" ] %> '); 这真的有效吗?
我认为您误解了会话的概念.会话是服务器端每用户数据存储区,它使您可以将用户数据保存在服务器端.您可以在cookie中存储和读取字符串信息.只需尝试将值存储在cookie中,然后在页面加载中仅找到cookie(如果存在)并替换会话值即可.
--Amit
报价:要租用dotnet,
谢谢..我会的.
报价:致_Amy,
也许我误会了..:D实际上我使用了那个,因为我需要下一页后面的dropdownlist的值..
Hi guys,
Can you please help me? i''ve been working this for a couple of days, yet can''t solve it. I have Dropdownlist, is it possible that everytime i select dropdownlist it will create a session thru javascript. it will overwrite the current value after i select item on dropdownlist. with no button intervention.. is that possible? please help.. i''m using MVC3 (c#). please guide me.. thanks.
regards,
-naijeru-
var myvar = "Hey Buddy"; '<%Session["temp"] = "' + myvar +'"; %>' ; alert('<%=Session["temp"] %>'); Does this really work? the javascript is executing on the client side.
I think you misunderstood the concept of session. Session is a server side per-user-data-store which allows you to save user data on the server side. You can store and read string information in a cookie. Just try storing value in the cookie and in page load only find the cookie(if exists) and replace the session value.
--Amit
Quote:To hiredotnet,
thanks.. i''ll it.
Quote:To _Amy,
maybe i misunderstood.. :D actually i use that one because i need the value of dropdownlist later on next page..
这篇关于使用javascript进行设置会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!