Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. File authentication

File authentication

Scheduled Pinned Locked Moved ASP.NET
questiondatabasesecurity
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fred_Smith
    wrote on last edited by
    #1

    I can set up a website with some folders requiring that users log in before being able to access the aspx pages therein using forms.authentication, and configuring web.config appropriately - all fine and dandy. So if, say, a protected folder is "members" and someone tries to access members/index.aspx they are redirected to a login page first. Great - but if there is a pdf in that folder, say members.pdf then ANYONE can still browse directly to members/members.pdf WITHOUT being logged in. How do I set about protecting .pdf, .doc, jpg etc files from unauthorised access in this way? Just a pointer will do.... thanks

    D 1 Reply Last reply
    0
    • F Fred_Smith

      I can set up a website with some folders requiring that users log in before being able to access the aspx pages therein using forms.authentication, and configuring web.config appropriately - all fine and dandy. So if, say, a protected folder is "members" and someone tries to access members/index.aspx they are redirected to a login page first. Great - but if there is a pdf in that folder, say members.pdf then ANYONE can still browse directly to members/members.pdf WITHOUT being logged in. How do I set about protecting .pdf, .doc, jpg etc files from unauthorised access in this way? Just a pointer will do.... thanks

      D Offline
      D Offline
      DotNetXenon
      wrote on last edited by
      #2

      Fred_Smith wrote:

      How do I set about protecting .pdf, .doc, jpg etc files from unauthorised access in this way?

      You can write the handler and allow .pdf/.doc/.jpg etc access only through application and stop them when trying to access through browser directly. Get it http://www.uberasp.net/getarticle.aspx?id=13[^]

      ------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates

      F 1 Reply Last reply
      0
      • D DotNetXenon

        Fred_Smith wrote:

        How do I set about protecting .pdf, .doc, jpg etc files from unauthorised access in this way?

        You can write the handler and allow .pdf/.doc/.jpg etc access only through application and stop them when trying to access through browser directly. Get it http://www.uberasp.net/getarticle.aspx?id=13[^]

        ------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates

        F Offline
        F Offline
        Fred_Smith
        wrote on last edited by
        #3

        good link - thanks

        D 1 Reply Last reply
        0
        • F Fred_Smith

          good link - thanks

          D Offline
          D Offline
          DotNetXenon
          wrote on last edited by
          #4

          You are welcome :)

          ------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates

          F 1 Reply Last reply
          0
          • D DotNetXenon

            You are welcome :)

            ------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates

            F Offline
            F Offline
            Fred_Smith
            wrote on last edited by
            #5

            hmm... tried that, word for word, and an even simpler "hello world" type example I found elsewhere (though it was the almost identical code) - and while it compiles fine, when I try to browse to an aspx file in the app I get the error: "Could not load type [class name] from assembly [assembly name]" (If I browse to a jpg - one of the filetypes I'm trying to protect - it is shown as normal.) I have tried googling this error, but have found nothing useful - just a reference to it possibly being to do with the GAC, but no help... ... I don't suppose you've got any ideas...? cheers Fred

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups