简体   繁体   English

重定向ASP.net之后的会话

[英]Session after redirect ASP.net

I am pretty new to ASP.Net and I am testing how the sessions work after a redirect. 我对ASP.Net相当陌生,并且正在测试重定向后会话的工作方式。 The problem is that I am not able to retrieve my data after i redirected. 问题是重定向后我无法检索数据。

code form 1: 代码形式1:

Session["person"] = person; // Object
Session["relation"] = relation; // Object
Response.Redirect("~/Fom2.aspx", false); // found online this has to be false to keep session token

code form 2: 代码表2:

Person person = (Person)(Session["person"]); //null
Relation relation = (Relation)(Session["relation"]); //null

Can anybody help me? 有谁能够帮助我? Thnx 日Thnx

The string in Session["string"] has to be exactly the same. Session["string"]中的Session["string"]必须完全相同。 Remove the space from Session["person "] in form 2 so it is Session["person"] 在表格2中从Session["person "]删除空格,因此它是Session["person"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM