ASP.NET 4 Response.Redirect not working from / but is from /index.aspx
I have a very basic test page, with a button and on the button click a call to
Response.Redirect("开发者_StackOverflow中文版b.aspx")
This works fine when the page is loaded as http://myhost/index.aspx
. However when the same page loads via http://myhost/
, the redirect doesn't work (the same page just reloads like a normal postback).
The only thing I've been able to determine is that the response code for /
is 200, whereas for /index.aspx
it's correctly 302
The server is IIS7 running ASP.NET4.
I have tried using true and false as the second param in Redirect()
but no difference.
Thanks Dan
Index.aspx is not a default homepage for ASPX.
Try default.apx when you try to just type www.yoursite.com it will load your default.aspx
Hope this helps
精彩评论