Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we can Apply security Authorization On a Particular Folder containing various webforms in a website

i am using asp.net 4.0
Posted
Comments
walterhevedeich 7-Apr-11 22:21pm    
Just curious. Why would you want to put security authorization on folders in a website?

1 solution

Found this using google (google is free for everyone to use, BTW):

Place a separate web.config file in the desired folder that will deny access to every request to that folder if the user isn't in the Admin role.

It would look something like this:

<location path="MySecureFolder">  
    <system.web>   
        <authorization>    
            <allow roles="Admin"/>    
            <deny users="*"/>   
        </authorization>  
    </system.web> 
</location> 
 
Share this answer
 
Comments
Shagun Bansal 7-Apr-11 15:35pm    
but bu applying this the erroer comes:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Sandeep Mewara 8-Apr-11 1:17am    
This means, you have now 2 web.config file in your root.

Better place this tag that JSOP suggested in the original Web.Config file.

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