相关疑难解决方法(0)

表单auth重定向css/script包含到HTTP 302的登录页面

我在登录页面,css文件和js文件中有一些包含.

<link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css" />
<script type="text/javascript" src="../../ext/bootstrap.js"></script>
Run Code Online (Sandbox Code Playgroud)

不幸的是,浏览器为这些请求获得了302响应.Forms Auth将请求视为未经授权并将其重定向到登录页面.它没有意识到请求首先来自登录页面.

GET http://localhost:50880/ext/resources/css/ext-all.css HTTP/1.1

HTTP/1.1 302 Found
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/Account/LogOn?ReturnUrl=%2fext%2fresources%2fcss%2fext-all.css">here</a>.</h2>
</body></html>
Run Code Online (Sandbox Code Playgroud)

我想也许设置包含文件夹(ext)的权限可能对每个人都有帮助.

我在其他项目中没有遇到过这个问题.

asp.net-mvc forms-authentication http-status-code-302

43
推荐指数
4
解决办法
2万
查看次数

HTTP错误404.15 - 未找到...因为查询字符串太长

我查了很多关于这个错误的帖子,但还没能解决问题.

我有一个在Windows 8 pro上运行的VS2013内置的简单MVC5网站.创建站点后,将选择单个帐户的选项.我现在需要启用Windows身份验证,以便只有AD帐户用户可以使用网站和授权,以便我可以限制对特定AD组的某些视图/控制器的访问.

在VS中选择了Web项目后,我更新了属性窗口(F4),以便将匿名身份验证设置为禁用,并将Windows身份验证设置为已启用.

该项目的web.config现在包含以下部分:

<system.web>
    <authentication mode="Windows" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthenticationModule" />
    </modules>
  </system.webServer>
Run Code Online (Sandbox Code Playgroud)

我从IIS或F5访问该站点我收到错误:HTTP错误404.15 - 未找到请求筛选模块配置为拒绝查询字符串太长的请求.我注意到有些东西已经循环以提供一个ReturnUrl,它是查询字符串中的重复长连接.

在IIS\Authentication部分中,我已设置为禁用"匿名身份验证,ASP.Net模拟和表单身份验证".在IIS.Net授权规则部分中,我设置为拒绝"匿名用户"并允许"所有用户"

我哪里错了?

iis asp.net-mvc windows-authentication

18
推荐指数
3
解决办法
4万
查看次数