4
它有什么优势或差异时使用...Sitecore:Sitecore.Web.WebUtil.Redirect优于Response.Redirect的优点是什么?
Sitecore.Web.WebUtil.Redirect(string path)
的...,而不是...
Response.Redirect(string url)
...重定向?
它有什么优势或差异时使用...Sitecore:Sitecore.Web.WebUtil.Redirect优于Response.Redirect的优点是什么?
Sitecore.Web.WebUtil.Redirect(string path)
的...,而不是...
Response.Redirect(string url)
...重定向?
有一个主要区别。 Sitecore方法将检查实际上是否存在HttpContext
。除此之外,没有差别,因为Sitecore.Web.WebUtil.Redirect(string path)
依次调用HttpContext.Current.Response.Redirect(path, true)
;
但是,如果您拨打Sitecore.Web.WebUtil.Redirect(path, false)
并且您提供的路径与您在同一页面上,则不会发生重定向。
感谢您的信息。 – Jake