Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
How can i protect a folder which is in a web directory. The folder contains many type of files mostly pdf and i want to restrict a anonymous user to access these files which can be done by typing file name along with path in url.

Many Thanks,
Dinesh
Posted

To access a file by typing file name along with path in url present on a web server following things are needed:
1) User must know the name of the file.
2) User must know the directory structure of your website application folder.

Without knowing these two things it is nearly impossible for any "anonymous" user to access file on your web server.

There is something called Directory Listing which is disabled by default in IIS for any website hosted on it. If this option is enabled, any user can see the directory structure of your website and thus may access resources on it.

So, my suggestion for your issue is very simple - keep this option disabled.
You may search Google for "IIS directory listing" for detail information on the same.

Hope this helps!
 
Share this answer
 
v2
try this Link

Link [^]
 
Share this answer
 
in web.config you can define the authentication for users. In the following section only for you allow the authentication and deny for others.

<authorization>
    <allow users="dinesh_ahuja"/>
    <deny users="*"/>
</authorization>


There is also a <location> tag that you can use to specify a particular file or directory to which settings wrapped by that tag, within the <configuration> section.


Actually that mechanism is not an easy step to work on. You may explore a lot related to that.
 
Share this answer
 
Comments
CodingLover 7-Apr-11 2:48am    
read the following article

http://support.microsoft.com/?id=893662

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