Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 允许在我的登录表单MVC上访问我的Site.Css_Html_Asp.net Mvc - Fatal编程技术网

Html 允许在我的登录表单MVC上访问我的Site.Css

Html 允许在我的登录表单MVC上访问我的Site.Css,html,asp.net-mvc,Html,Asp.net Mvc,我需要我的css来显示我的登录页面,但它现在没有显示。我如何允许访问包含css的登录页面?我使用表单身份验证,我的web.config文件的代码块如下所示: <authentication mode="Forms"> <forms loginUrl="UserAccount/Login" defaultUrl="UserAccount/Index" timeout="60"></forms> </authentication> <auth

我需要我的css来显示我的登录页面,但它现在没有显示。我如何允许访问包含css的登录页面?我使用表单身份验证,我的web.config文件的代码块如下所示:

<authentication mode="Forms">
  <forms loginUrl="UserAccount/Login" defaultUrl="UserAccount/Index" timeout="60"></forms>
</authentication>
<authorization>
  <deny users="?"/>
  <allow users="*"/>
</authorization>

My site.css位于My/Content/site.css路径中。如何添加它以允许所有用户访问此文件

拒绝匿名用户访问css文件。(读)

因此,您需要将以下内容放入web.config中的
块中

<location path="Content">
    <system.web>
      <authorization>
        <allow users="?"/>
      </authorization>
    </system.web>
  </location>


我偶然发现了这个,因为我需要同样的东西。以下是一个解决方案:

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

(我使用了上一个答案中的链接)这将允许未经验证的用户访问Content文件夹中的所有文件,css文件位于该文件夹中。

抱歉,伙计们,这和前面的答案一样,忽略这个

我通过以下步骤来解决这个问题: IIS管理器
身份验证
右键单击匿名身份验证。


切换到应用程序池标识

这正是我需要的解决方案。