使用时有什么优势或区别吗...
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)
并且您提供的路径与您所在的页面相同,则不会发生重定向。
关于asp.net - Sitecore:Sitecore.Web.WebUtil.Redirect 相对于 Response.Redirect 有何优势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10984261/