C#中的会话变量 [英] Session variable in C#

查看:104
本文介绍了C#中的会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





在我的项目中,我在会话中存储了一些城镇名称,一旦会话过期我想重定向基于城镇名称的页面,我存储在过期的会话中。任何人都可以帮我解决这个问题。





谢谢,

Baskar G

Hi,

In my project, I have stored some town name in session, once session is expired I want to redirect the page based on town name which I stored in expired session. Can any one help me how to achieve this.


Thanks,
Baskar G

推荐答案

您的会话过期后无法访问。您可以将数据存储在cookie中,如果会话是新会话(即旧会话已过期)且cookie存在,则可以根据cookie值重定向。



谷歌如何检测它是否是一个新的会话,以及如果你不知道如何做这些事情,如何读取'#write cookies。
You can't access the session after it has expired. You could store the data in a cookie, and if the session is a new session (ie the old one has expired) and the cookie exists, then you can redirect based on the cookie value.

Google for how to detect if it's a new session, and also how to read\write cookies if you don't know how to do those things.


这篇关于C#中的会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆