如何分配会话值 [英] how session value is assigned
问题描述
protected void btn_fourthPage_Click(object sender, EventArgs e)
{
try
{
HttpContext.Current.Session["fourthpage"] = "4";
Response.Redirect("~/LoginPage.aspx",false);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
可以解释4如何分配
can any one explain how 4 is assigned
推荐答案
您应该阅读:在ASP.NET中探索会话 [ ^ ]
并 MSDN:ASP.NET会话状态概述 [ ^ ]
- Amit
You should read : Exploring Session in ASP.NET[^]
And MSDN : ASP.NET Session State Overview[^]
--Amit
请参阅此链接
在ASP.NET中探索会话 [ ^ ] [在上面的回答中提供了一个lso]
它声明
Refer to this link
Exploring Session in ASP.NET[^][Provided in above answer also]
It states that
ASP.NET使用120位标识符来跟踪每个会话。这足够安全,无法进行逆向工程。当客户端与服务器通信时,只在它们之间传输会话ID。当客户端请求数据时,ASP.NET会查找会话ID并检索相应的数据。这是通过以下步骤完成的:
-Client点击网站,信息存储在会话中。
-Server创建一个该客户端的唯一会话ID并将其存储在会话状态提供程序中。
-客户端请求来自服务器的唯一会话ID的某些信息。
-Server看起来在Session Providers中并从状态服务器中检索序列化数据并输入类型转换对象。
ASP.NET uses an 120 bit identifier to track each session. This is secure enough and can't be reverse engineered. When a client communicates with a server, only the session ID is transmitted between them. When the client requests for data, ASP.NET looks for the session ID and retrieves the corresponding data. This is done in the following steps:
-Client hits the web site and information is stored in the session.
-Server creates a unique session ID for that client and stores it in the Session State Provider.
-The client requests for some information with the unique session ID from the server.
-Server looks in the Session Providers and retrieves the serialized data from the state server and type casts the object.
请参阅此内容
HttpSessionState.SessionID Property [ ^ ]
问候......:笑:
Refer to this also
HttpSessionState.SessionID Property[^]
Regards.. :laugh:
这篇关于如何分配会话值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!