views:

83

answers:

3

A client has sent out an email with a link containging a typo for a website we run [E.g. http://example.com/?id=123.]. What is the best way to re-direct anyone who visits the bad URL?

If someone clicks on the link, can we catch it in the Global.asax, checking if the path ends with "." then removing it and re-directing? If so, where in Global should it be?

If another method is better I'm happy to hear it; the most important thing is speed as this is needs to be nipped in the bud ASAP!

A: 

You need to use something like ISAPI_REWRITE for url re-writing in IIS (If IIS 6) because I'm not sure that that request would even be handled by .NET with that extension

Nick Allen - Tungle139
Just an FYI, but in this case, I would assume they have a Default.aspx which the above URL would actually call. So ASP.Net would get the request.
TJMonk15
Sure, makes sense. Although if done through re-writing you can make it a 301 permanent re-direct which would work better for search engines
Nick Allen - Tungle139
+2  A: 

Its not the best solution, but you could use Application_BeginRequest in the global.asax file.

And better way if you are using IIS 7.0 is URL Rewriting

TJMonk15
Unfortunately, the site's server is only IIS 6. So I whacked the test and re-direct in the Application_BeginRequest as you suggested and it is working now. Do you or anybody know of the performance hit for this test? I imagine it would be called a helluva lot...
Rich
A: 

If you happen to not have IIS 7.0 you can always use ISAPI_Rewrite (the free edition). Working mainly on regex you can redirect or rewrite any url.

http://www.helicontech.com/isapi_rewrite/

Frank
If their webserver has even 2 sites on it, the lite version wont work, or i guess might just cause issues down the road...
TJMonk15
It'll probably work but it'll require some tweak in the config file
Frank