Reputation: 2527
I am implementing when user enters "m.co-oprating.com" it will be redirect to "www.co-oprating.com/mobile", but when I used the following code it doesn't work:
if (Request.Url.Host.StartsWith("m."))
{
UriBuilder builder = new UriBuilder(Request.Url);
builder.Host = "www." + Request.Url.Host;
Response.Clear();
Response.StatusCode = 301;
Response.StatusDescription = "Moved Permanently";
Response.AddHeader("Location", "www.co-oprating.com/mobile");
Response.End();
}
Was it because the request did not reach co-oprating.com at all, do I have to fix the DNS ?
Upvotes: 0
Views: 91
Reputation: 12351
I have to fix the DNS
Yes.
nslookup
> m.co-oprating.com
Server: google-public-dns-a.google.com
Address: 8.8.8.8
*** google-public-dns-a.google.com can't find m.co-oprating.com: Non-existent domain
Upvotes: 1