HttpWebRequest持有会话变量 [英] HttpWebRequest holding session variables
问题描述
您好,
我编写此代码用于初始化从asp.net页面到另一个页面的Web请求asp.net页面:
System.Net。
HttpWebRequest webRequest = null ; System.Ne t。
WebResponse webResponse = null ; 会话[ "MySession" ] =值; webRequest.KeepAlive = true ; webResponse = webRequest.GetResponse();
webRequest =(系统。 Net。 HttpWebRequest )System.Net。 HttpWebRequest 。创建( "page.aspx" );
我的问题是我想要后面的page.aspx代码来读取Session ["MySession"]值。
是 posibble 而不使用cookie或缓存代替会话?
您可以获取代码隐藏的会话值。此外,您可以将值保存在cookie中。
但是作为Session,cookies 是ASP.NET的一部分,所以最好在 ASP.NET上提出你的问题论坛
Hello,
I've written this code to initialize a web request from an asp.net page to another asp.net page:
System.Net.
HttpWebRequest webRequest = null;
System.Net.
WebResponse webResponse = null;
Session[ "MySession"] = Value; webRequest.KeepAlive = true;
webResponse = webRequest.GetResponse();
webRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("page.aspx");
My problem is that I want the page.aspx code behind to read the Session["MySession"] value.
Is it posibble without using cookies or cache instead of session?
You can get Session value for code-behind. Also you can save the value in cookies.
But as Session, cookies are part of ASP.NET, so it would be better to ask your question on ASP.NET Forum
这篇关于HttpWebRequest持有会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!