Файл SharePoint 2010 CrossDomain.xml - PullRequest
       8

Файл SharePoint 2010 CrossDomain.xml

0 голосов
/ 16 сентября 2011

Мы развернули файл crossdomain.xml в корне экземпляра Sharepoint 2010, чтобы определить политику междоменной флэш-памяти.В SP2007 это работало, как и ожидалось, но в SP2010 файл name заблокирован.

Если мы переименуем файл, то он будет обработан чем-либо, кроме crossdomain.xmlКак только мы называем его тем, что хотим, он выдает ошибку 404.

Есть идеи, как обойти это?Я предполагаю, что теперь должен быть способ управления этим файлом через сам SharePoint?

Я искал ответ, отличный от копирования файла crossdomain.xml в корень IIS.

1 Ответ

3 голосов
/ 20 сентября 2011

Я обнаружил причину, по которой это не работает.Оказывается, в SharePoint 2010 пути crossdomain.xml и clientaccesspolicy исключены из поставщика виртуальных путей и поэтому никогда не будут обслуживаться из базы данных контента SharePoint.

Код спрятан в Sharepoint SPRequestModule (см. Ниже).Единственное разумное решение - развернуть файл crossdomain.xml в корне 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);
    }
}
...