Aycan Yaşıt
Aycan Yaşıt

Reputation: 2114

Only chosen ones would see directory content

In my project, I want to let users who logged in to see content of a spesific directory. I didn't disable directory browsing in IIS, so everyone can access the content of this directory.

Is it possible to prevent users who aren't logged in to access the content of this directory?

Upvotes: 1

Views: 34

Answers (1)

Piotr Stapp
Piotr Stapp

Reputation: 19820

You could try to disable access for this folder in web.config. The example:

<location path="AdminFolder">
  <system.web>    
    <authorization>
       <allow roles="Admin"/> //Allows users in Admin role
       <deny users="*"/> // deny everyone else
    </authorization>
  </system.web>
</location>

More you can find on Setting authorization rules for a particular page or folder in web.config

Upvotes: 2

Related Questions