Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

301 Redirect in asp.net

I have just uploaded a new website www.tapasya.co.in. When I tried to access, it showing me a blank page. But when I tried using the complete path of the home page http://www.tapasya.co.in/Web%20Pages/Home.aspx , its working.

I think, I have figured the problem, which might be occuring. I have to put this page at the root folder, to access it using www.tapasya.co.in. But I don't want to put this page at the root folder. I searched it on google, and some solutions says, that I have to do a 301 redirect.

But I dont know how to do that. Please help, thanks in advance.

like image 789
Vaibhav Jain Avatar asked Dec 21 '25 04:12

Vaibhav Jain


1 Answers

Something like this is meant by 301 redirect :

private void Page_Load(object sender, System.EventArgs e)
{
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location","http://www.aspcode.net/newpage");
}

More info here.

like image 158
Tomas Vana Avatar answered Dec 22 '25 21:12

Tomas Vana