private static void SetPortalName(WebForm form, int languageCode) { var portalName = languageCode.ToString(CultureInfo.InvariantCulture); var portals = PortalCrmConfigurationManager.GetPortalCrmSection().Portals; if (portals.Count <= 0) { return; } var found = false; foreach (var portal in portals) { var portalContext = portal as PortalContextElement; if (portalContext != null && portalContext.Name == portalName) { found = true; } } if (found) { form.PortalName = portalName; } }
private static void SetResponseParameters(HttpResponse response) { var section = PortalCrmConfigurationManager.GetPortalCrmSection(); var policy = section.CachePolicy.EmbeddedResource; Utility.SetResponseCachePolicy(policy, response, HttpCacheability.Public, defaultVaryByContentEncodings: "gzip;deflate"); }
private static void SetResponseParameters(HttpResponseBase response, HttpCacheability defaultCacheability, Entity attachment, Entity webfile, ICollection <byte> data) { response.StatusCode = (int)HttpStatusCode.OK; response.ContentType = attachment.GetAttributeValue <string>("mimetype"); var contentDispositionText = "inline"; if (webfile != null) { var contentDispositionOptionSetValue = webfile.GetAttributeValue <OptionSetValue>("adx_contentdisposition"); if (contentDispositionOptionSetValue != null) { switch (contentDispositionOptionSetValue.Value) { case 756150000: // inline contentDispositionText = "inline"; break; case 756150001: // attachment contentDispositionText = "attachment"; break; default: contentDispositionText = "inline"; break; } } } if (string.Equals(response.ContentType, "text/html", StringComparison.OrdinalIgnoreCase) || string.Equals(response.ContentType, "application/octet-stream", StringComparison.OrdinalIgnoreCase)) { contentDispositionText = "attachment"; } var contentDisposition = new StringBuilder(contentDispositionText); AppendFilenameToContentDisposition(attachment, contentDisposition); response.AppendHeader("Content-Disposition", contentDisposition.ToString()); response.AppendHeader("Content-Length", data.Count.ToString(CultureInfo.InvariantCulture)); var section = PortalCrmConfigurationManager.GetPortalCrmSection(); var policy = section.CachePolicy.Annotation; Utility.SetResponseCachePolicy(policy, response, defaultCacheability); }
/// <summary> /// Sets the http response parameters for status code, caching, and headers. /// </summary> private static void SetResponseParameters(HttpResponse response, HttpCacheability defaultCacheability, Entity annotation, byte[] data) { response.StatusCode = (int)HttpStatusCode.OK; response.ContentType = annotation.GetAttributeValue <string>("mimetype"); var contentDisposition = new StringBuilder("inline"); AppendFilenameToContentDisposition(annotation, contentDisposition); response.AppendHeader("Content-Disposition", contentDisposition.ToString()); response.AppendHeader("Content-Length", data.Length.ToString()); var section = PortalCrmConfigurationManager.GetPortalCrmSection(); var policy = section.CachePolicy.Annotation; Utility.SetResponseCachePolicy(policy, response, defaultCacheability); }
protected void Page_Init(object sender, EventArgs e) { IsLookupCreateForm = !string.IsNullOrEmpty(Request.QueryString["lookup"]); var languageCodeSetting = HttpContext.Current.Request["languagecode"]; if (string.IsNullOrWhiteSpace(languageCodeSetting)) { return; } int languageCode; if (!int.TryParse(languageCodeSetting, out languageCode)) { return; } EntityFormControl.LanguageCode = languageCode; var portalName = languageCode.ToString(CultureInfo.InvariantCulture); var portals = PortalCrmConfigurationManager.GetPortalCrmSection().Portals; if (portals.Count <= 0) { return; } var found = false; foreach (var portal in portals) { var portalContext = portal as PortalContextElement; if (portalContext != null && portalContext.Name == portalName) { found = true; } } if (found) { EntityFormControl.PortalName = portalName; } }
public static void PreApplicationStart() { if (InitialSetupIsRunning()) { DynamicModuleUtility.RegisterModule(typeof(SetupRoutingModule)); RegisterBundles(BundleTable.Bundles); } else { DynamicModuleUtility.RegisterModule(typeof(PortalRoutingModule)); if (!FormsEnabled()) { var portalConfiguration = PortalCrmConfigurationManager.GetPortalCrmSection(); portalConfiguration.ConfigurationProviderType = "Site.Areas.Account.Models.ApplicationPortalCrmConfigurationProvider, Site"; var roleManager = ConfigurationManager.GetSection("system.web/roleManager") as RoleManagerSection; if (roleManager != null) { var roleProvider = roleManager.Providers[roleManager.DefaultProvider]; roleProvider.Parameters["attributeMapUsername"] = "******"; } AntiForgeryConfig.SuppressXFrameOptionsHeader = true; } else { DynamicModuleUtility.RegisterModule(typeof(SessionAuthenticationModule)); } // read the connection settings from the local file CrmConfigurationProvider.ConfigurationCreated += OnConfigurationCreated; PortalCrmConfigurationProvider.ConfigurationCreated += OnConfigurationCreated; } }