[thelist] Block a Referring URL

jono at charlestonwebsolutions.com jono at charlestonwebsolutions.com
Fri Mar 10 15:49:01 CST 2006

> Here is something I do in my Global.asax for a similar task...
> protected void Application_BeginRequest(object sender, EventArgs e)
> {
> 	/*get the url of the request*/
> 	string url=Converter.ToLowerCaseURL(Request.Url.ToString());
> 	if(
> 		url.IndexOf("example.com")==-1 &&
> 		url.IndexOf("example.net")==-1 &&
> 		url.IndexOf("example.org")==-1 &&
> 		url.IndexOf("xxx.xxx.xxx.xxx")==-1 /*the static IP of the site*/
> 	){
>      		Server.Transfer("/Leecher.aspx");
> 	}
> }
> Begin_Request is called on each and every request as its name implies.
> I don't know how it translates into PHP but I think it kinda solves
> your problem.

Yes, what you posted makes sense; I just am not familiar with the
"Global.asax" part, which, I know, is the bulk of what makes your
suggestion work.

1.  Does the code you posted above go into a file named "Global.asax"?
2.  Does "Global.asax" goes in the directory I am trying to block access
to from the particular URL?
3.  Also will this work OK with Apache?
4.  Anyoen know if this can be translated into a PHP solution?

I am not much of a programmer, more of a front end/UI guru, but I find my
self more and more getting involved with this type of stuff.  Can you help
me out a bit more with you suggestions?

Jono Young
Designer | Developer | Illustrator
Charleston Web Solutions
Bringing Higher Standards to the Lowcountry

More information about the thelist mailing list