How to prevent deep linking to files on my website

后端 未结 5 933
名媛妹妹
名媛妹妹 2020-12-17 20:34

I own a website which contain a lot of freeware stuff to download on it. The problem I\'m facing is that people from around the world are taking the direct links of the fil

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 20:49

    I'm not at all a web expert, but I was thinking about the following pointer -

    if you're using asp.net could http handlers or modules configured at the web site level help (lot's of information on those on the web, I looked it up recently for some work, here's one article for example.

    The idea is to intercept the request before it reaches the target file and redirect it to the page you wish to show; for example - if someone wishes to browse to the url you've posted ("http://sy-stu.org/stu/PublicFiles/StdLibrary/Exam.zip") intercept this call,use some lookup to find the page you wish to display and redirect the request there;I'm guessing users following a link won't be too annoyed (unless they have done "save target as", which would result them saving some HTML and not ZIP).

    However, there's some "hole" in my plan - how do you actually provide a link that works from your own page? I believe you can differentiate between requests coming from your web site and ones coming from others' which you could check on the handler/module by examining the request object.

提交回复
热议问题