What is a simple way to secure a directory in asp.net? [closed]
Is there an easy way to do this?
In your web.config, you can use the following:
<location path="AdminDirectory">
<system.web>
<authorization>
<allow roles="Administrators"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
See here: msft.
You can use forms authentication which allows you to specify if authenticated users can access pages by groups.
Unless of course you mean "real" directories that contain files. What are you securing? The file system, or the paths to the pages?
精彩评论