我们已经在SharePoint2010实例的根中部署了一个crossdomain.xml文件,以定义闪存跨域策略。在SP2007中,这与预期的一样工作,但它SP2010文件名被阻塞。
如果我们将该文件重命名为crossdomain.xml以外的任何内容,那么它就被服务了。只要我们把它命名为我们想要的,它就会抛出一个404错误。
有什么办法解决这个问题吗?我猜现在一定有办法通过SharePoint本身来控制这个文件吧?
除了将crossdomain.xml文件复制到IIS的根目录之外,我还在寻找其他答案。
发布于 2011-09-19 22:01:49
我发现了这个不起作用的原因。在SharePoint 2010中,path crossdomain.xml和clientaccesspolicy被排除在虚拟路径提供程序之外,因此永远不会从SharePoint内容数据库中得到服务。
代码隐藏在Sharepoint SPRequestModule中(见下文)。唯一明智的解决方案是将crossdomain.xml文件部署到每个web服务器上的IIS根目录,这并不理想。
[SharePointPermission(SecurityAction.Demand, ObjectModel=true)]
void IHttpModule.Init(HttpApplication app)
{
if (app is SPHttpApplication)
{
if (!_virtualPathProviderInitialized)
{
lock (_virtualServerDataInitializedSyncObject)
{
if (!_virtualPathProviderInitialized)
{
Dictionary<string, ExclusionAttributes> dictionary = new Dictionary<string, ExclusionAttributes>(StringComparer.OrdinalIgnoreCase);
dictionary["/app_themes"] = ExclusionAttributes.Folder;
dictionary["/app_browsers"] = ExclusionAttributes.Folder;
dictionary["/defaultwsdlhelpgenerator.aspx"] = ExclusionAttributes.File;
dictionary["/clientaccesspolicy.xml"] = ExclusionAttributes.File;
dictionary["/crossdomain.xml"] = ExclusionAttributes.File;
VirtualPathProvider virtualPathProvider = HostingEnvironment.VirtualPathProvider;
if ((virtualPathProvider != null) && virtualPathProvider.DirectoryExists("/"))
{
VirtualDirectory directory = virtualPathProvider.GetDirectory("/");
if (directory != null)
{
IEnumerable children = directory.Children;
if (children != null)
{
foreach (VirtualFileBase base2 in children)
{
string str = base2.VirtualPath.TrimEnd(new char[] { '/' });
ExclusionAttributes attributes = 0;
if (base2.IsDirectory)
{
attributes |= ExclusionAttributes.Folder;
}
else
{
attributes |= ExclusionAttributes.File;
}
dictionary[str] = attributes;
}
}
}
}
_excludedFileList = dictionary;
SPVirtualPathProvider provider2 = new SPVirtualPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(provider2);
_virtualPathProviderInitialized = true;
}
SPTemplateFileSystemWatcher.Local.Initialize();
SPPerformanceCounterAgent current = SPPerformanceCounterAgent.Current;
}
}
app.BeginRequest += new EventHandler(this.BeginRequestHandler);
app.PostAuthenticateRequest += new EventHandler(this.PostAuthenticateRequestHandler);
app.PostAuthorizeRequest += new EventHandler(this.PostAuthorizeRequestHandler);
app.PostResolveRequestCache += new EventHandler(this.PostResolveRequestCacheHandler);
app.PostAcquireRequestState += new EventHandler(this.PostAcquireRequestStateHandler);
app.PreRequestHandlerExecute += new EventHandler(this.PreRequestExecuteAppHandler);
app.PostRequestHandlerExecute += new EventHandler(this.PostRequestExecuteHandler);
app.ReleaseRequestState += new EventHandler(this.ReleaseRequestStateHandler);
app.Error += new EventHandler(this.ErrorAppHandler);
app.PostLogRequest += new EventHandler(this.PostLogRequestHandler);
app.EndRequest += new EventHandler(this.EndRequestHandler);
}
}https://stackoverflow.com/questions/7447659
复制相似问题