【问题标题】:Sitecore: What is the advantage of Sitecore.Web.WebUtil.Redirect over Response.Redirect?Sitecore:与 Response.Redirect 相比,Sitecore.Web.WebUtil.Redirect 有什么优势?
【发布时间】:2012-06-11 16:46:01
【问题描述】:

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

Sitecore.Web.WebUtil.Redirect(string path)

...而不是...

Response.Redirect(string url)

...用于重定向?

【问题讨论】:

    标签: asp.net redirect sitecore


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2016-07-04
      • 2011-03-13
      • 1970-01-01
      • 1970-01-01
      • 2011-09-27
      • 2010-09-24
      • 2010-12-27
      • 2011-11-06
      • 2015-04-06
      相关资源
      最近更新 更多