Click here to Skip to main content
15,880,405 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello fellow programmers got a few error here. I am managing my web.config to set authorization and authentication. My problem is when I run my project, My master page's design is not working but when I logged on it returns to its original design. Is there any conflict between master page and authorization?
XML
<authentication mode="Forms">
      <forms loginUrl="Login.aspx" protection="All" timeout="30" name=".ASPXAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Login.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="false"/>
    </authentication>
     <authorization>
       <allow roles="Administrator,Talent Development Manager,Talent Development Coordinator,Discipline Manager"/>
       <deny users="?"/>
     </authorization>
Posted

All directories or files in the same directory with this Web.config file could not be accessed if not login. So to access common files such as Master Pages, Stylesheet files, images, you should store those in separated directories and all those directories must have their own Web.config file with the following content:
HTML
<configuration>
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
</configuration>
 
Share this answer
 
Add this after your system.web tag that contains the deny users="?":

XML
<location path="Styles/Site.css">
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</location>
 
Share this answer
 
Comments
CHill60 3-Apr-14 17:17pm    
You're 2 years too late repeating an accepted solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900