Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to block a list of domains like abc.com, xyz.co.uk to access my asp.net website while browsing from a link from that domain or via any script on that domain. The desired result, it will give the 403 response to scripts that try and remotely access our website from a certain domain - or if it is accessed via a browser from a link from that domain.

I want to block domains not IPs because IPs may be dynamically changed.

I can use the referer header, but can't depend on it always being sent (or being correct)

Note: My ASP.NET website hosted on IIS 7.5.

Regards,
Habib
Posted
Updated 20-Jan-14 8:46am
v2
Comments
[no name] 20-Jan-14 14:47pm    
Why do you want to do it ?

1 solution

Quote:
I can use the referer header, but can't depend on it always being sent (or being correct)


This is true. Apart from the header, you got nearly no chance to know which page the user visited previously. This is a basic idea of websites, and is not easy to be changed. You can pre-assume that most of the browsers will send the correct header, and use it to block the access.
If this isn't enough you can examine what cookies a web site places on the computer and then check whether these cookies do exist. I don't see any other approach apart from these possible solutions.

Just out of curiosity: Why do you need this feature?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900