简体   繁体   English

重定向到ASP.Net中的当前页面

[英]redirect to current page in ASP.Net

How can I perform a redirect with Server.Transfer() to the same page that is currently shown? 如何将Server.Transfer()重定向到当前显示的同一页面?

I want to have A cleared form after submit. 我希望在提交后获得A格式。

What other/better methods can I use to achieve the same? 我可以使用哪些其他/更好的方法来实现相同的目标?

Why Server.Transfer ? 为什么Server.Transfer Response.Redirect(Request.RawUrl) would get you what you need. Response.Redirect(Request.RawUrl)您的需求。

http://en.wikipedia.org/wiki/Post/Redirect/Get http://en.wikipedia.org/wiki/Post/Redirect/Get

The most common way to implement this pattern in ASP.Net is to use Response.Redirect(Request.RawUrl) 在ASP.Net中实现此模式的最常用方法是使用Response.Redirect(Request.RawUrl)

Consider the differences between Redirect and Transfer . 考虑重定向和转移之间差异 Transfer really isn't telling the browser to forward to a clear form , it's simply returning a cleared form. 转移真的不是告诉浏览器转发到一个清晰的表单 ,它只是返回一个清除的表单。 That may or may not be what you want. 这可能是也可能不是你想要的。

Response.Redirect() does not a waste round trip. Response.Redirect()不会浪费往返。 If you post to a script that clears the form by Server.Transfer() and reload you will be asked to repost by most browsers since the last action was a HTTP POST. 如果您发布到由Server.Transfer()清除表单的脚本并重新加载,则由于上一个操作是HTTP POST,因此大多数浏览器都会要求您重新发布。 This may cause your users to unintentionally repeat some action, eg. 这可能会导致您的用户无意中重复某些操作,例如。 place a second order which will have to be voided later. 下一个必须在以后废除的第二个订单。

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

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