开发者

How to use ASP.NET Authorization Yet Permit Access to .css Files?

<authentication mode="Forms">
      <forms loginUrl="Login.aspx"/>
</authentication>
<authorization>
      <deny users="?"/>
</authorization>

I am using forms authentication, and when i place the arguments cited above, the css formatting I have done for the whol开发者_如何学Pythone document is not being implemented, it's vanishing. what should i be doing so that the CSS remains intact.


I assume that your login form has an external CSS file, and that you're using Cassini or IIS 7 integrated mode.

Your <deny users="?"/> is preventing anonymous users from seeing the login form's CSS files.

You need to use the <location> element to allow anonymous users to see the CSS files, like this:

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


Use the location element to allow access to your css:

<configuration>
   <location path="style.css">
      <system.web>
         <authorization>
            <allow users="?"/>
         </authorization>
      </system.web>
   </location>
</configuration>


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

**


please add this code in web config file

<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-GB"/>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜