By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,734 Members | 890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,734 IT Pros & Developers. It's quick & easy.

Restrict Direct Browsing - Download

100+
P: 115
hi friends


i have one problem. i m using forms authentication for my pages which consist of downloadable links (doc files, pdf files etc.,). the thing is, if i restrict access to the page, it works fine ( redirects anonymous users to login page). however, if someone types the url of the documents directly (ex:- mywebserver/myapp/downloads/documentname, it directly downloads without authenticating.

any way to restrict direct downloading of files?



am using web.config file like this

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <configuration>
  3.  
  4.   <location path="images">
  5.     <system.web>
  6.       <httpHandlers >
  7.         <httpHandlers>
  8.           <add verb="*" path="*.jpg" type="HTTPjpegAccess.HTTPjpegAccess, HTTPjpegAccess"/>
  9.         </httpHandlers>
  10.       </httpHandlers>
  11.       <authentication mode="Forms">
  12.         <forms loginUrl="login.aspx">
  13.           <credentials passwordFormat="Clear">
  14.             <user name="yoga" password="yoga" />
  15.           </credentials>
  16.         </forms>
  17.       </authentication>
  18.  
  19.       </system.web>
  20.   </location>
  21.  
  22. </configuration>
but it is not working

pls guide me

it is very urgent

pls give sample code

thanks
Dec 11 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 750
PRR
i think you will have to look into IIS configuration... application mappings...
look into that ....
Dec 11 '08 #2

Frinavale
Expert Mod 5K+
P: 9,731
This video tutorial will prove to be useful in explaining how to do this.

-Frinny
Dec 11 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.