窗体身份验证重定向的CSS /脚本包括登录页面与HTTP 302 [英] Forms auth redirecting css/script includes to the login page with HTTP 302

查看:763
本文介绍了窗体身份验证重定向的CSS /脚本包括登录页面与HTTP 302的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个登录页面,一个css文件和js文件的一些包括

I have some includes on a login page, a css file and a js file.

<link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css" />
<script type="text/javascript" src="../../ext/bootstrap.js"></script>

不幸的浏览器,使对这些请求得到302响应。窗体身份验证是看到请求未经授权,并将其重定向到登录页面。它不知道该请求是从登录页面放在第一位正在添加。

Unfortunatly the requests the browser makes for these get the 302 response. Forms Auth is seeing the request as unauthorized and redirecting them to the login page. It doesn't realise that the request are comming from the login page in the first place.

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>

我想也许设定的文件夹包括(EXT)的权限,每个人都可能会有帮助。

I thought perhaps setting the permissions of the includes folder (ext) to everyone might help.

我已经没有其他项目这个问题。我不知道怎么回事。任何帮助将大大appriciated。

I've not had this issue in other projects. I'm not sure whats going on. Any help would be much appriciated.

推荐答案

您需要从得到认证为配置文件中的以下排除的CSS文件和图像。使用位置标记,您可以排除单个文件或目录。

You need to exclude the css files and images from getting authenticated as following in the configuration file. Using the location tag you can exclude a single file or a directory.

<location path="<RELATIVE_PATH_OF_YOUR_RESOURCE_FILES>">
    <system.web>
        <authorization>
            <allow users="*"/>
        </authorization>
    </system.web>
</location>

这篇关于窗体身份验证重定向的CSS /脚本包括登录页面与HTTP 302的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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