【问题标题】:Rewritepath not working in case of subsites (Sharepoint 2013)Rewritepath 在子站点的情况下不起作用(Sharepoint 2013)
【发布时间】:2017-11-13 10:32:21
【问题描述】:

我创建了一个网络服务,以便通过引用 - http://syncspviewoutlook.codeplex.com/ 与 Outlook 同步任务。 (此功能基本上将当前用户任务与 Outlook 同步,而不是同步所有任务,只要单击连接到 Outlook 以获得任务列表)

我创建了一个 httpmodule 以便使用路径 customservice.asmx 而不是 Global.asax 文件重写路径(lists.asmx),该文件适用于父站点(http://example:8081/) 下面是调用我的自定义 web 服务的代码。

public void context_BeginRequest(object sender, EventArgs e) {

            HttpContext ctx = HttpContext.Current;
            if (ctx != null)
            {
                string path = ctx.Request.Url.AbsolutePath;
                string userAgent = ctx.Request.UserAgent;
                if (!string.IsNullOrEmpty(userAgent))
                {
                    if (userAgent.Contains("Microsoft Office Outlook") && path.ToLower().IndexOf("_vti_bin/lists.asmx") >= 0)
                    {
                        ctx.RewritePath("/_layouts/15/folder/customservice.asmx");
                    }
                }
            }

    }

但是当我尝试在我的子站点中同步任务时,重写路径似乎不起作用,甚至没有抛出任何错误。它不会调用新的 customservice.asmx url,即使它符合要求 - (ctx.RewritePath("/_layouts/15/folder/customservice.asmx");)

关于为什么调用原始 lists.asmx 而不是子站点的新列表 (http://example:8081/subsite1/) 的任何想法。我确实启用了跟踪,但找不到任何错误。

【问题讨论】:

    标签: c# asp.net sharepoint


    【解决方案1】:

    能够解决上述问题.. 在这里回答https://social.msdn.microsoft.com/Forums/sharepoint/en-US/cf58fa8d-2806-4732-a556-5996a86d5c10/rewritepath-not-working-in-case-of-subsites?forum=sharepointdevelopment

    我不得不将我的调用从 BeginRequest 更改为 PostResolveRequestCache

    【讨论】:

      猜你喜欢
      • 2017-05-04
      • 2013-06-04
      • 1970-01-01
      • 2016-09-20
      • 2015-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多