Reputation: 29664
We have a web app where we need to redirect customers from .com
to .co.uk
domains based on the geolocation of ther IP address. When/where should I do this?
The content will change slightly based on their location, but I think I can handle that OK. However, if anyone has any comments on the best way to handle this, I'd like to hear those comments as well.
Upvotes: 0
Views: 142
Reputation: 630549
If you want to do this in application code, I would do this as early as the IP is available, in the Application_BeginRequest
handler in global.asax:
protected void Application_BeginRequest(object sender, EventArgs e)
{
var ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
//Redirect here...
}
Upvotes: 1
Reputation: 8788
I would use an HttpModule. It's the earliest place to do the redirection.
Upvotes: 1