public static ICrossDomainPolicy BuildFlashPolicy(HttpWebResponse response) { ICrossDomainPolicy policy = null; if ((response.StatusCode == HttpStatusCode.OK) && CheckContentType(response.ContentType)) { try { policy = FlashCrossDomainPolicy.FromStream(response.GetResponseStream()); } catch (Exception ex) { Console.WriteLine(String.Format("CrossDomainAccessManager caught an exception while reading {0}: {1}", response.ResponseUri, ex)); // and ignore. } if (policy != null) { // see DRT# 864 and 865 string site_control = response.InternalHeaders ["X-Permitted-Cross-Domain-Policies"]; if (!String.IsNullOrEmpty(site_control)) { (policy as FlashCrossDomainPolicy).SiteControl = site_control; } } } // the flash policy was the last chance, keep a NoAccess into the cache if (policy == null) { policy = no_access_policy; } AddPolicy(response.ResponseUri, policy); return(policy); }