简体   繁体   English

ASP.NET重定向

[英]ASP.NET Redirection

I'm currently redirecting a page using 我目前正在使用重定向网页

Response.Redirect("URL");

this works great, however it changes the url too. 这很好用,但是它也会更改URL。 For example: 例如:

http://localhost/index.aspx

Redirected to: test.aspx will change the url to: 重定向到:test.aspx会将URL更改为:

http://localhost/test.aspx

Is it possbile to redirect the content without changing the URL?... so the Url will be: 是否可以在不更改URL的情况下重定向内容 ?...因此,网址为:

http://localhost/test.aspx

BUT the content would of been redirected to 但是内容将被重定向到

test.aspx

Thank you. 谢谢。

Try to use Server.Transfer(URL); 尝试使用Server.Transfer(URL); to avoid changing the url. 避免更改网址。

More info here . 更多信息在这里

And also check the differences at this post and this one . 并且还要检查此职位 职位的区别。

Make sure that this solution meets your needs. 确保此解决方案满足您的需求。

使用Server.Transfer这将显示default.aspx页的内容,但不会更改url

Server.Transfer("Default.aspx");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM