5

使用时有什么优势或区别...

Sitecore.Web.WebUtil.Redirect(string path)

...代替...

Response.Redirect(string url)

...用于重定向?

4

1 回答 1

12

有一个主要区别。Sitecore 方法将检查是否确实存在HttpContext. Sitecore.Web.WebUtil.Redirect(string path)除此之外,轮流调用没有区别HttpContext.Current.Response.Redirect(path, true)

但是,如果您调用Sitecore.Web.WebUtil.Redirect(path, false)并且您提供的路径与您所在的页面相同,则不会发生重定向。

于 2012-06-11T16:53:43.633 回答