Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Darren Hunter 46 posts 116 karma points
    23 days ago
    Darren Hunter
    0

    Hi,

    I am working on a site for a client that has a members area and I need a way to stop specific files from been downloaded by any one.

    I have been trying to use a controller to hijack http requesteds but it dose not seem to be working.

    Is there a way using IHttpHandler to intercept http reqest on download. I started to look at this but I am using the latest version of version 8 and it dose not seem to be hitting my custome media control. Even though I have registed the control using:

    composition.Register

    I just need to intercept the http request and check the file if it restricted or not. I know I can check using the media service to get the file propertys so that not a problem, the Issue I am having is I can't intercept any HTTP requests.

  • Huw Reddick 876 posts 2960 karma points
    23 days ago
    Huw Reddick
    0

    you will need to write an IHttpHandler

  • Darren Hunter 46 posts 116 karma points
    22 days ago
    Darren Hunter
    0

    I have tried that but it not working, do I need to register it or should it just work out of the box??

    I can't find any thing in the documentation on how to register a IHttpHandler

  • Huw Reddick 876 posts 2960 karma points
    21 days ago
    Huw Reddick
    0

    I'm away from my pc currently but will check what I did in the morning

  • Huw Reddick 876 posts 2960 karma points
    21 days ago
    Huw Reddick
    0

    IIRC you register it in web.config

  • Conor Howe 25 posts 105 karma points
    21 days ago
  • Huw Reddick 876 posts 2960 karma points
    20 days ago
    Huw Reddick
    0

    I had to change the web.config that is in the media folder, not the websites web.config

    My media folder web.config is like below

        <?xml version="1.0" encoding="UTF-8"?>
        <configuration>
          <system.webServer>
            <handlers>
              <clear />
              <add name="DOCX" path="*.docx" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
              <add name="XLSX" path="*.xlsx" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
              <add name="DOC" path="*.doc" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
              <add name="XLS" path="*.xls" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
              <add name="PDF" path="*.pdf" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
              <add name="ZIP" path="*.zip" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
              <add name="EPS" path="*.eps" verb="*" type="MyApp.ProtectedMediaHttpHandler" />
    .....
            </handlers>
          </system.webServer>
        </configuration>
    
Please Sign in or register to post replies

Write your reply to:

Draft