执行重定向到一个虚拟目录时应用程序失去认证 [英] Application loses authentication when performing redirect to a virtual directory

查看:122
本文介绍了执行重定向到一个虚拟目录时应用程序失去认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下设置:
http://www.example.com/dir1/
http://www.example.com/dir2/

每个虚拟目录上IIS6.0配置为自己的应用程序池的应用程序。

Each virtual directory is configured on IIS6.0 as an application with own AppPool.

当从DIR1重定向身份验证的用户使用的Response.Redirect到DIR2我失去了认证信息为用户和用户被重定向到登录页面。这个问题没有想出每个应用程序(DIR1 DIR2和)的子域名下的配置,例如:
http://dir1.example.com 并的 http://dir2.example.com

When redirecting authenticated user from dir1 to dir2 using response.redirect I lose authentication information for the user and the user is being redirected to the login page. This issue was not coming up with each app (dir1 and dir2) were configured under subdomain, ex: http://dir1.example.com and http://dir2.example.com.

我已经加入了机关键machine.config文件解决了问题。

I have resolved the issue by adding a machine key to the machine.config file.

为什么它不是在 http://www.example.com/dir1配置?

推荐答案

我经常配置应用这种方式。有几个地方,你可以误入歧途。

I regularly configure applications this way. There are a few places you can go astray.


  1. 每个web.config中必须有一个共同的machineKey部分完全相同的副本。例如。产生一个部分,并将其粘贴到您要共享FormsTickets所有web.configs。

  1. Each web.config must have an exact duplicate of a common machineKey section. E.G. generate one section and paste it into all web.configs that you want to share FormsTickets with.

每个的MembershipProvider(和角色/配置文件等)的元素必须共享相同的applicationName属性。默认情况下,这是'/'所以,除非您手动更改它不存在应问题。

Each MembershipProvider (and Roles/Profiles etc) element must share the same applicationName attribute. By default this is '/' so unless you have manually changed it there should be not problem.

在所有应用程序的所有供应商必须共用一个连接字符串到一个共同的aspnetdb的实例。

All providers in all applications must share a common connection string to a common aspnetdb instance.

如果您已经尝试了所有这些步骤单独或增量很可能是数据库处于不一致的状态。确保每个这些要求得到满足,一个全新的数据库开始。

If you have tried any of these steps individually or incrementally it is likely that the DB is in an inconsistent state. Ensure that each of these requirements is satisfied and start with a fresh database.

如果您按照这些步骤你应该没有问题。这是一个相当普遍和直接的使用案例。

If you follow these steps you should have no problems. This is a fairly common and straight forward use case.

让我知道如果你有任何问题。

Let me know if you have any more questions.

这篇关于执行重定向到一个虚拟目录时应用程序失去认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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