2011-09-16 10 views
0

플래시 교차 도메인 정책을 정의하기 위해 Sharepoint 2010 인스턴스의 루트에 crossdomain.xml 파일을 배포했습니다. SP2007에서는 예상대로 작동했지만 SP2010 파일 이 차단되었습니다.SharePoint 2010 CrossDomain.xml 파일

파일의 이름을 crossdomain.xml으로 변경하면 파일이 제공됩니다. 우리가 원하는 이름을 붙이 자마자 404 오류가 발생합니다.

어떤 아이디어로 해결할 수 있습니까? SharePoint 자체를 통해이 파일을 제어하는 ​​방법이 있어야한다고 생각합니다.

나는 crossdomain.xml 파일을 IIS의 루트에 복사하는 것 이외의 다른 해결책을 찾고 있습니다.

+0

남을 돕는 방법으로 질문에 대답 할 수 있습니까? 그렇게하면 정답으로 자신을 선택할 수 있습니다. 이상하게 보일 수도 있지만, 이와 같은 상황을 처리하는 데 선호되는 방법입니다. – Will

답변

3

이것이 작동하지 않는 이유를 발견했습니다. SharePoint 2010에서 경로 crossdomain.xmlclientaccesspolicy은 가상 경로 공급자에서 제외되므로 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); 
    } 
}