窗体身份验证忽略默认文档 [英] Forms Authentication Ignoring Default Document

查看:118
本文介绍了窗体身份验证忽略默认文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了一天半的时间试图解决这个问题。 Bascially有一个ASP.net网站,窗体身份验证使用框架4.0 IIS7。

I have spent a day and a half trying to resolve this issue. Bascially have an ASP.net website with Forms Authentication on IIS7 using Framework 4.0.

该授权的东西似乎是与没有specifed文档击中它的每一个例外场景,完美的工作(应解析为默认文件)。

The Authorization stuff seems to be working perfectly for every scenario with the exception of hitting it with no document specifed (Should resolve to Default Doc).

例如(请不要在现场恶劣的还是待开发;))
http://www.rewardroster.com/Default.aspx 完美的作品,这个页面应该允许匿名访问作为指定web.config中。

For example (Please don't be harsh on site its still be developed ;) ), http://www.rewardroster.com/Default.aspx works perfectly, this page should allow anon access as specified in the web.config.

但如果我打www.rewardroster.com直接重​​定向到登录页面,返回URL设置为/或为Login.aspx?RETURNURL =%2F

but if I hit www.rewardroster.com Directly it redirects to the login page with Return URL set to "/" or Login.aspx?ReturnUrl=%2f

有些东西我曾尝试:

1)认证设置为无,然后默认的文档工作这么那不是问题。

1) Set Authentication to None and then the Default document worked so thats not the issue.

2)增加DefaultDocument属性的Web.config

2) Added DefaultDocument attribute to Web.config

3)删除了所有条目的默认文档列表在IIS中除了Default.aspx的

3) Deleted all entries for in Default Document list in IIS except for Default.aspx

4)配置的machineKey添加条目

4) Added MachineKey entry in Config

5)综合切换到经典管道在IIS

5) Toggled from Integrated to Classic pipeline in IIS

下面是什么在我的配置:

Here is what's in my config:

  <authentication mode="Forms">
    <forms name="appNameAuth" loginUrl="Login.aspx" protection="All" timeout="60" slidingExpiration="true" defaultUrl="Default.aspx" path="/">
    </forms>
  </authentication>
  </authentication>

 <location path="Default.aspx">


   
        
        
      
  
 

非常感谢您的时间和希望有人知道是怎么回事。

Thanks so much for your time and hope someone knows what is going on here.

推荐答案

这是我的解决方案:

的Global.asax ,方式:的Application_BeginRequest ,将以下内容:

In Global.asax, method: Application_BeginRequest, place the following:

if (Request.AppRelativeCurrentExecutionFilePath == "~/")  
   HttpContext.Current.RewritePath("HomePage.aspx");

尼斯和简单,你有机会建立一个围绕你想,如果你的网站使用基于配置变量多个主页使用什么样的主页逻辑。

Nice and simple, and you have a chance to build logic around what home page you want to use if your website uses multiple home pages based on configuration variables.

Dmitry.Alk

Dmitry.Alk

这篇关于窗体身份验证忽略默认文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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