【发布时间】: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