Hi tektippers,
I have a check and redirect for the global.asax so that all pages start with not It also ensures that many of our domains we have registered get redirected to our main domain name.
My question is how can i log the original source url that they used so i can keep track of the usage of that non-primary domain name?
I have tried logging to the database but the db isnt initialized yet at this point in the begin request it seems.
Any ideas would be greatly appreciated.
Adam
I have a check and redirect for the global.asax so that all pages start with not It also ensures that many of our domains we have registered get redirected to our main domain name.
My question is how can i log the original source url that they used so i can keep track of the usage of that non-primary domain name?
I have tried logging to the database but the db isnt initialized yet at this point in the begin request it seems.
Code:
protected void Application_BeginRequest(object sender, EventArgs e)
{
string authority = HttpContext.Current.Request.Url.Authority;
if (authority.IndexOf("localhost") != 0 && authority.IndexOf("[URL unfurl="true"]www.mydomain.com")[/URL] != 0)
{
Response.StatusCode = 301;
Response.Redirect("[URL unfurl="true"]http://www.mydomain.com"[/URL] +
HttpContext.Current.Request.Url.PathAndQuery, true);
}
}
Any ideas would be greatly appreciated.
Adam