Chaitanya
Chaitanya

Reputation: 1708

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 whole document is not being implemented, it's vanishing. what should i be doing so that the CSS remains intact.

Upvotes: 9

Views: 8426

Answers (4)

K.Rahul
K.Rahul

Reputation: 1

please add this code in web config file

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

Upvotes: -2

Kasun
Kasun

Reputation: 1

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

**

Upvotes: 0

sestocker
sestocker

Reputation: 3532

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>

Upvotes: 6

SLaks
SLaks

Reputation: 887807

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>

Upvotes: 20

Related Questions