Restrict Direct Browsing - Download

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yogarajan
    New Member
    • Apr 2007
    • 115

    Restrict Direct Browsing - Download

    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

    Code:
    <?xml version="1.0"?>
    <configuration>
      
      <location path="images">
        <system.web>
          <httpHandlers >
            <httpHandlers>
              <add verb="*" path="*.jpg" type="HTTPjpegAccess.HTTPjpegAccess, HTTPjpegAccess"/>
            </httpHandlers>
          </httpHandlers>
          <authentication mode="Forms">
            <forms loginUrl="login.aspx">
              <credentials passwordFormat="Clear">
                <user name="yoga" password="yoga" />
              </credentials>
            </forms>
          </authentication>
          
          </system.web>
      </location>
    
    </configuration>
    but it is not working

    pls guide me

    it is very urgent

    pls give sample code

    thanks
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    i think you will have to look into IIS configuration.. . application mappings...
    look into that ....

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      This video tutorial will prove to be useful in explaining how to do this.

      -Frinny

      Comment

      Working...