会话变量在iis7应用程序中为空 [英] Session variable empty in iis7 application

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

问题描述

我有一个使用ajax的asp.net应用程序.我希望能够将数据从一页传递到另一页,因此我将所需的内容存储在会话变量中,并将响应重定向到目标页,在该页中我检索所需的内容以进行进一步处理.我使用:

I have an asp.net application that uses ajax. I want to be able to pass data from one page to another so I store what I want in a session variable and redirect the response to the destination page where i retrieve what i want for further processing. I use:

Response.Redirect(path, false)

一切正常,直到我尝试将其发布到暂存iis7服务器上为止.我的会话变量始终返回空.但是,如果我尝试从iis服务器本身中导航到该页面(通过在iis中的页面上单击鼠标右键,然后单击浏览"),则它会很好地工作并且保留会话变量值.仅当我从浏览器访问iis应用程序时,它才执行此操作.其他所有功能都可以正常运行,例如加载页面,控件和重定向.只是会话变量的结果为空.

Everything works fine until I try to publish to my staging iis7 server. My session variable always returns empty. But if I try to navigate to the page from within the iis server itself (via right click on the page in iis and clicking explore) it works well and the session variable value is retained. It only does it when I am accessing the iis application from my browser. Everything else works well like loadin pages, controls, the redirect. It is only that the session variables result to empty.

推荐答案

当应用程序池配置错误时,例如将工作进程数设置为多个时,可能会发生这种情况.

This can happen when the application pool is misconfigured, like for example if you set the number of worker processes to more than one.

此问题的另一个常见原因是服务器名称包含下划线(例如DEV_TEST).下划线不能用作主机名,并且可能会干扰设置cookie的能力.

Another common cause of this issue is when the server name contains underscores (e.g. DEV_TEST). Underscores aren't allowed as host names, and could interfere with the ability to set cookies.

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

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