开发者

ASP.NET 4 Response.Redirect not working from / but is from /index.aspx

开发者 https://www.devze.com 2023-02-06 22:50 出处:网络
I have a very basic test page, with a button and on the button click a call to Response.Redirect(\"开发者_StackOverflow中文版b.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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号