I need my css to show for my login page, but it's not showing at the moment. How would I go about allowing access to my login page with the css included? Im using forms authentication, and my code block for my web.config file looks as such:
<authentication mode="Forms">
<forms loginUrl="UserAccount/Login" defaultUrl="UserAccount/Index" timeout="60"></forms>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
My site.css is in my /Content/Site.css path. How do I add it to allow access to this file to all users?
the <deny users="?"/>
denies anonymous users from accessing the css file. (read here )
so you'll need to put the following into your <configuration>
block within web.config
<location path="Content">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
you can read some more about this here
I work this out by the followings steps: IIS Manager
Authentication
Right Click Anonymous Authentication.
Switch to application pool identity
Stumbled across this, cause I needed the same thing. Here is a solution:
<location path="Content">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
As is writer here (I used the link from the previous answer) this will give the unauthenticated user access to all the files in the Content folder, and the css file is in this folder. PS sorry guys, this is the same as the previous answer, just ignore this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.