Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sharepoint 2010 SharePoint 2010 CrossDomain.xml文件_Sharepoint 2010_Cross Domain Policy - Fatal编程技术网

Sharepoint 2010 SharePoint 2010 CrossDomain.xml文件

Sharepoint 2010 SharePoint 2010 CrossDomain.xml文件,sharepoint-2010,cross-domain-policy,Sharepoint 2010,Cross Domain Policy,我们已将crossdomain.xml文件部署到Sharepoint 2010实例的根目录中,以定义flash跨域策略。在SP2007中,这与预期的一样有效,但在SP2010中,文件名被阻止 如果我们将该文件重命名为crossdomain.xml以外的任何名称,则会提供该文件。一旦我们把它命名为我们想要的,它就会抛出一个404错误 有没有办法解决这个问题?我猜现在一定有办法通过SharePoint本身控制这个文件了吧 我一直在寻找答案,而不是将crossdomain.xml文件复制到IIS的根目

我们已将
crossdomain.xml
文件部署到Sharepoint 2010实例的根目录中,以定义flash跨域策略。在SP2007中,这与预期的一样有效,但在SP2010中,文件名被阻止

如果我们将该文件重命名为
crossdomain.xml
以外的任何名称,则会提供该文件。一旦我们把它命名为我们想要的,它就会抛出一个404错误

有没有办法解决这个问题?我猜现在一定有办法通过SharePoint本身控制这个文件了吧


我一直在寻找答案,而不是将crossdomain.xml文件复制到IIS的根目录中。

我发现了这不起作用的原因。事实证明,在SharePoint 2010中,路径
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);
    }
}
[SharePointPermission(SecurityAction.Demand,ObjectModel=true)]
void IHttpModule.Init(HttpApplication应用程序)
{
if(应用程序为SPHTTPA应用程序)
{
如果(!\u VirtualPathProvider初始化)
{
锁定(_virtualServerDataInitializedSyncObject)
{
如果(!\u VirtualPathProvider初始化)
{
字典字典=新字典(StringComparer.OrdinalIgnoreCase);
dictionary[“/app_themes”]=ExclutionAttributes.Folder;
字典[“/app\u browsers”]=ExclutionAttributes.Folder;
dictionary[“/defaultwsdlhelpgenerator.aspx”]=ExclutionAttributes.File;
dictionary[“/clientaccesspolicy.xml”]=ExclutionAttributes.File;
字典[“/crossdomain.xml”]=ExclutionAttributes.File;
VirtualPathProvider VirtualPathProvider=HostingEnvironment.VirtualPathProvider;
if((virtualPathProvider!=null)&&virtualPathProvider.DirectoryExists(“/”)
{
VirtualDirectory目录=virtualPathProvider.GetDirectory(“/”);
if(目录!=null)
{
IEnumerable children=directory.children;
如果(子项!=null)
{
foreach(儿童中的VirtualFileBase base2)
{
字符串str=base2.VirtualPath.TrimEnd(新字符[]{'/'});
排除属性=0;
if(base2.IsDirectory)
{
attributes |=ExclutionAttributes.Folder;
}
其他的
{
attributes |=ExclutionAttributes.File;
}
字典[str]=属性;
}
}
}
}
_excludedFileList=字典;
SPVirtualPathProvider provider2=新的SPVirtualPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(provider2);
_virtualPathProviderInitialized=true;
}
SPTemplateFileSystemWatcher.Local.Initialize();
SPPerformanceCounterAgent当前=SPPerformanceCounterAgent.current;
}
}
app.BeginRequest+=新事件处理程序(this.BeginRequestHandler);
app.PostAuthenticateRequest+=新事件处理程序(this.PostAuthenticateRequestHandler);
app.postauthorizereRequest+=新事件处理程序(this.postauthorizereRequestHandler);
app.PostResolveRequestCache+=新的EventHandler(this.PostResolveRequestCacheHandler);
app.PostAcquireRequestState+=新事件处理程序(this.PostAcquireRequestStateHandler);
app.PreRequestHandlerExecute+=新事件处理程序(this.PreRequestExecuteAppHandler);
app.PostRequestHandlerExecute+=新事件处理程序(this.PostRequestExecuteHandler);
app.ReleaseRequestState+=新的EventHandler(this.ReleaseRequestStateHandler);
app.Error+=新的EventHandler(this.ErrorAppHandler);
app.PostLogRequest+=新的EventHandler(this.PostLogRequestHandler);
app.EndRequest+=新的EventHandler(this.EndRequestHandler);
}
}

我发现了这不起作用的原因。事实证明,在SharePoint 2010中,路径
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);
    }
}
[SharePointPermission(SecurityAction.Demand,ObjectModel=true)]
void IHttpModule.Init(HttpApplication应用程序)
{
if(应用程序为SPHTTPA应用程序)
{
如果(!\u VirtualPathProvider初始化)
{
锁定(_virtualServerDataInitializedSyncObject)
{
如果(!\u VirtualPathProvider初始化)
{
字典字典=新字典(StringComparer.OrdinalIgnoreCase);
dictionary[“/app_themes”]=ExclutionAttributes.Folder;
字典[“/app\u browsers”]=ExclutionAttributes.Folder;
字典[“/defaultwsdlhelpgeneras”