I am trying to redirect a page on a server root (http://www.new-url.com/default.aspx) to another page in a directory on the same domain (http://www.new-url.com/main/default.aspx) using the following .NET code:
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com/main/default.aspx");
}
When I do this, the redirect seems to loop on the directory:
http://www.new-url.com/main/main/main/main/main/main/main/main/main/main/main/main/main/main/...
Is it possible to do a 301 redirect, using .Net or IIS, to a directory withing the same domain? Is 301 redirect only possible to do from one domain to another? The web is on a Windows 2008 server using IIS7.