从 Request.GetResponse() 获取会话信息
我有一个加载许多 asp.net 页面的应用程序,在每个循环中我需要从加载页面的会话中获取一些信息。
我怎样才能做到这一点?
例子:
WebRequest request = HttpWebRequest.Create(url);
WebResponse response = request.GetResponse();
//How to get the Session from response???
I have an aplication that loads many asp.net pages and in every loop I need to take some information from the Sesion of the loaded page.
How can I do that?
example:
WebRequest request = HttpWebRequest.Create(url);
WebResponse response = request.GetResponse();
//How to get the Session from response???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不能。会话状态对象位于服务器上。
You can't. Session state object is on the server.
如果这种情况发生的可能性很小,那将是一场安全噩梦。会话数据在服务器内存中受到保护,并且只能由站点应用程序池中运行的对象访问。如果您需要以这种方式从远程页面获取信息,则必须重组远程页面以通过添加标头或 cookie 来提供信息。
If this were even remotely possible it would be a security nightmare. Session data is protected in the server's memory and is only accessible to objects running within the application pool of the site. If you need information from a remote page in this manner, the remote page will have to be restructured to provide the information either through added headers or cookies.