更新时间:2022-04-05 22:50:45
您应该提供从发帖页面RedirectToUrl参数。
You should provide a RedirectToUrl parameter from the posting page.
依托引荐头是不是一个好的做法。
Relying on referrer headers is not a good practice.
相反,做这样的事情:
public ActionResult Delete(int id, string RedirectToUrl)
{
// check if RedirectToUrl is null or empty and redirect accordingly
}
在发布视图或局部视图,你可以提供的参数在几个方面:
On the posting view or partial view you can provide the parameter in several ways:
<%= Html.Hidden("RedirecToUrl","/my/lovely/url") %>
或
<form action="/item/delete/22?RedirectToUrl=/my/lovely/url">
我preFER第一个选项。
I'd prefer the first option.