升级后的应用程序来MVC 4,AUTH_USER是空白 [英] Upgraded app to MVC 4, AUTH_USER is blank

查看:303
本文介绍了升级后的应用程序来MVC 4,AUTH_USER是空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个混合传统的ASP + ASP.NET MVC 4应用在Win服务器2K3(IIS6)我们已经升级到使用MVC 4运行。

I have a hybrid classic ASP + ASP.NET MVC 4 application running under Win Server 2k3 (IIS6) which we have upgraded to use MVC 4.

在ASP应用程序通过一个虚拟目录连接到.NET应用程序。他们在同一个应用程序池中运行(如果该事项)。这种特殊的应用程序是一个管理控制面板,并使用基本身份验证:

The ASP app is attached to the .NET application via a virtual directory. They run in the same application pool (if that matters). This particular app is an admin control panel, and uses basic authentication:

升级项目,访问时为虚拟文件夹中的网址前,浏览器会显示登录提示,在那里我输入域限定的用户名和密码。然后,ASP code通过 Request.ServerVariables检索用户名(AUTH_HEADER),比较了与存储在数据库中的应用程序级别的权限列表,并启用或禁用基于管理网站功能。

Before upgrading the project, when access the url for the virtual folder, the browser would display a login prompt, where I enter my domain-qualified username and password. The ASP code then retrieves the user name via Request.ServerVariables("AUTH_HEADER"), compares that against an application-level permissions list stored in the database, and enables or disables features in the admin site based on that.

升级项目后,我仍然得到登录提示,但 Request.ServerVariables(AUTH_USER)返回一个空字符串。

After upgrading the project, I still get the login prompt, but Request.ServerVariables("AUTH_USER") returns an empty string.

我已经添加了旧项目进入一个新的网站,让我可以在同一服务器上并行运行它们。旧code继续工作。新的code拒绝。在管理​​在.NET应用点的每个版本在磁盘上相同的物理位置的虚拟目录,并在这两个应用程序.NET的文件夹的身份验证配置是相同的。

I've added the old project into a new website so I can run them in parallel on the same server. The old code continues to work. The new code refuses to. The admin virtual directory in each version of the .NET application points to the same physical location on disk, and the authentication configuration for the folder in both .NET apps is identical.

建议?需要注意的是MVC 4应用程序是使用.NET 4的框架,而不是.NET 4.5,这是不是在服务器上安装。

Suggestions? Note that the MVC 4 app is using the .NET 4 framework, not .NET 4.5, which is not installed on the server.

注意的是,虽然在截图默认域字段为空,它的配置是否正确。我从显而易见的原因,图像中删除它。

Note that, although the default domain field in the screenshot is blank, it is properly configured. I've removed it from the image for obvious reasons.

推荐答案

Request.ServerVariables(AUTH_USER),可当你配置你的应用程序使用Forms身份验证不是Windows验证来获得。如果是Windows身份验证,你应该使用Request.ServerVariables(LOGON_USER)

Request.ServerVariables("AUTH_USER") can be obtained when you configured your application to use Forms authentication not Windows Authentication. If it is Windows Authentication you should use Request.ServerVariables("LOGON_USER")

这篇关于升级后的应用程序来MVC 4,AUTH_USER是空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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