public IActionResult YuebonConnecSys(string systype) { CommonResult result = new CommonResult(); try { if (!string.IsNullOrEmpty(systype)) { SystemType systemType = iService.GetByCode(systype); string openmf = MD5Util.GetMD5_32(DEncrypt.Encrypt(CurrentUser.UserId + systemType.Id, GuidUtils.NewGuidFormatN())).ToLower(); YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper(); TimeSpan expiresSliding = DateTime.Now.AddSeconds(20) - DateTime.Now; yuebonCacheHelper.Add("openmf" + openmf, CurrentUser.UserId, expiresSliding, false); result.ErrCode = ErrCode.successCode; result.ResData = systemType.Url + "?openmf=" + openmf; } else { result.ErrCode = ErrCode.failCode; result.ErrMsg = "切换子系统参数错误"; } } catch (Exception ex) { Log4NetHelper.Error("切换子系统异常", ex); result.ErrMsg = ErrCode.err40110; result.ErrCode = "40110"; } return(ToJsonContent(result)); }
Guid ToGuid(int id) { return(GuidUtils.ToGuid(id)); }
public void OnAfterDeserialize() { m_id = GuidUtils.SerializedGuidToGuid(SerializedGuid); }
private bool TryGetProfile(string profileName, bool doRefresh, out CredentialProfile profile) { if (doRefresh) { Refresh(); } Dictionary <string, string> profileDictionary = null; if (TryGetSection(profileName, out profileDictionary)) { CredentialProfileOptions profileOptions; Dictionary <string, string> reservedProperties; Dictionary <string, string> userProperties; PropertyMapping.ExtractProfileParts(profileDictionary, ReservedPropertyNames, out profileOptions, out reservedProperties, out userProperties); string toolkitArtifactGuidStr; Guid? toolkitArtifactGuid = null; if (reservedProperties.TryGetValue(ToolkitArtifactGuidField, out toolkitArtifactGuidStr)) { if (!GuidUtils.TryParseNullableGuid(toolkitArtifactGuidStr, out toolkitArtifactGuid)) { Logger.GetLogger(GetType()).InfoFormat("Invalid value {0} for {1} in profile {2}. GUID expected.", toolkitArtifactGuidStr, ToolkitArtifactGuidField, profileName); profile = null; return(false); } } string regionString; RegionEndpoint region = null; if (reservedProperties.TryGetValue(RegionField, out regionString)) { region = RegionEndpoint.GetBySystemName(regionString); } string endpointDiscoveryEnabledString; bool? endpointDiscoveryEnabled = null; if (reservedProperties.TryGetValue(EndpointDiscoveryEnabledField, out endpointDiscoveryEnabledString)) { bool endpointDiscoveryEnabledOut; if (!bool.TryParse(endpointDiscoveryEnabledString, out endpointDiscoveryEnabledOut)) { Logger.GetLogger(GetType()).InfoFormat("Invalid value {0} for {1} in profile {2}. A boolean true/false is expected.", endpointDiscoveryEnabledString, EndpointDiscoveryEnabledField, profileName); profile = null; return(false); } endpointDiscoveryEnabled = endpointDiscoveryEnabledOut; } StsRegionalEndpointsValue?stsRegionalEndpoints = null; if (reservedProperties.TryGetValue(StsRegionalEndpointsField, out var stsRegionalEndpointsString)) { #if BCL35 try { stsRegionalEndpoints = (StsRegionalEndpointsValue)Enum.Parse(typeof(StsRegionalEndpointsValue), stsRegionalEndpointsString, true); } catch (Exception) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string regional/legacy is expected.", stsRegionalEndpointsString, StsRegionalEndpointsField, profileName); profile = null; return(false); } #else if (!Enum.TryParse <StsRegionalEndpointsValue>(stsRegionalEndpointsString, true, out var stsRegionalEndpointsTemp)) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string regional/legacy is expected.", stsRegionalEndpointsString, StsRegionalEndpointsField, profileName); profile = null; return(false); } stsRegionalEndpoints = stsRegionalEndpointsTemp; #endif } string s3UseArnRegionString; bool? s3UseArnRegion = null; if (reservedProperties.TryGetValue(S3UseArnRegionField, out s3UseArnRegionString)) { bool s3UseArnRegionOut; if (!bool.TryParse(s3UseArnRegionString, out s3UseArnRegionOut)) { profile = null; return(false); } s3UseArnRegion = s3UseArnRegionOut; } S3UsEast1RegionalEndpointValue?s3RegionalEndpoint = null; if (reservedProperties.TryGetValue(S3RegionalEndpointField, out var s3RegionalEndpointString)) { #if BCL35 try { s3RegionalEndpoint = (S3UsEast1RegionalEndpointValue)Enum.Parse(typeof(S3UsEast1RegionalEndpointValue), s3RegionalEndpointString, true); } catch (Exception) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string regional/legacy is expected.", s3RegionalEndpointString, S3RegionalEndpointField, profileName); profile = null; return(false); } #else if (!Enum.TryParse <S3UsEast1RegionalEndpointValue>(s3RegionalEndpointString, true, out var s3RegionalEndpointTemp)) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string regional/legacy is expected.", s3RegionalEndpointString, S3RegionalEndpointField, profileName); profile = null; return(false); } s3RegionalEndpoint = s3RegionalEndpointTemp; #endif } string s3DisableMultiRegionAccessPointsString; bool? s3DisableMultiRegionAccessPoints = null; if (reservedProperties.TryGetValue(S3DisableMultiRegionAccessPointsField, out s3DisableMultiRegionAccessPointsString)) { bool s3DisableMultiRegionAccessPointsOut; if (!bool.TryParse(s3DisableMultiRegionAccessPointsString, out s3DisableMultiRegionAccessPointsOut)) { Logger.GetLogger(GetType()).InfoFormat("Invalid value {0} for {1} in profile {2}. A boolean true/false is expected.", s3DisableMultiRegionAccessPointsString, S3DisableMultiRegionAccessPointsField, profileName); profile = null; return(false); } s3DisableMultiRegionAccessPoints = s3DisableMultiRegionAccessPointsOut; } RequestRetryMode?requestRetryMode = null; if (reservedProperties.TryGetValue(RetryModeField, out var retryModeString)) { #if BCL35 try { requestRetryMode = (RequestRetryMode)Enum.Parse(typeof(RequestRetryMode), retryModeString, true); } catch (Exception) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string legacy/standard/adaptive is expected.", retryModeString, RetryModeField, profileName); profile = null; return(false); } #else if (!Enum.TryParse <RequestRetryMode>(retryModeString, true, out var retryModeTemp)) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string legacy/standard/adaptive is expected.", retryModeString, RetryModeField, profileName); profile = null; return(false); } requestRetryMode = retryModeTemp; #endif } int?maxAttempts = null; if (reservedProperties.TryGetValue(MaxAttemptsField, out var maxAttemptsString)) { if (!int.TryParse(maxAttemptsString, out var maxAttemptsTemp) || maxAttemptsTemp <= 0) { Logger.GetLogger(GetType()).InfoFormat("Invalid value {0} for {1} in profile {2}. A positive integer is expected.", maxAttemptsString, MaxAttemptsField, profileName); profile = null; return(false); } maxAttempts = maxAttemptsTemp; } string ec2MetadataServiceEndpoint; if (reservedProperties.TryGetValue(EC2MetadataServiceEndpointField, out ec2MetadataServiceEndpoint)) { if (!Uri.IsWellFormedUriString(ec2MetadataServiceEndpoint, UriKind.Absolute)) { throw new AmazonClientException($"Invalid value {ec2MetadataServiceEndpoint} for {EC2MetadataServiceEndpointField} in profile {profileName}. A well-formed Uri is expected."); } } EC2MetadataServiceEndpointMode?ec2MetadataServiceEndpointMode = null; if (reservedProperties.TryGetValue(EC2MetadataServiceEndpointModeField, out var ec2MetadataServiceEndpointModeString)) { #if BCL35 try { ec2MetadataServiceEndpointMode = (EC2MetadataServiceEndpointMode)Enum.Parse(typeof(EC2MetadataServiceEndpointMode), ec2MetadataServiceEndpointModeString, true); } catch (Exception) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string IPv4 or IPV6 is expected.", ec2MetadataServiceEndpointModeString, EC2MetadataServiceEndpointModeField, profileName); profile = null; return(false); } #else if (!Enum.TryParse <EC2MetadataServiceEndpointMode>(ec2MetadataServiceEndpointModeString, true, out var ec2MetadataServiceEndpointModeTemp)) { _logger.InfoFormat("Invalid value {0} for {1} in profile {2}. A string IPv4 or IPV6 is expected.", ec2MetadataServiceEndpointModeString, EC2MetadataServiceEndpointModeField, profileName); profile = null; return(false); } ec2MetadataServiceEndpointMode = ec2MetadataServiceEndpointModeTemp; #endif } profile = new CredentialProfile(profileName, profileOptions) { UniqueKey = toolkitArtifactGuid, Properties = userProperties, Region = region, CredentialProfileStore = this, EndpointDiscoveryEnabled = endpointDiscoveryEnabled, StsRegionalEndpoints = stsRegionalEndpoints, S3UseArnRegion = s3UseArnRegion, S3RegionalEndpoint = s3RegionalEndpoint, S3DisableMultiRegionAccessPoints = s3DisableMultiRegionAccessPoints, RetryMode = requestRetryMode, MaxAttempts = maxAttempts, EC2MetadataServiceEndpoint = ec2MetadataServiceEndpoint, EC2MetadataServiceEndpointMode = ec2MetadataServiceEndpointMode }; if (!IsSupportedProfileType(profile.ProfileType)) { _logger.InfoFormat("The profile type {0} is not supported by SharedCredentialsFile.", profile.ProfileType); profile = null; return(false); } return(true); } profile = null; return(false); }
public async Task <IActionResult> RegisterAsync(RegisterViewModel info) { CommonResult result = new CommonResult(); YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper(); var vCode = yuebonCacheHelper.Get("ValidateCode" + info.VerifyCodeKey); string code = vCode != null?vCode.ToString() : "11"; if (code != info.VerificationCode.ToUpper()) { result.ErrMsg = "验证码错误"; return(ToJsonContent(result)); } if (!string.IsNullOrEmpty(info.Account)) { if (string.IsNullOrEmpty(info.Password) || info.Password.Length < 6) { result.ErrMsg = "密码不能为空或小于6位"; return(ToJsonContent(result)); } Tenant user = await iService.GetByUserName(info.Account); if (user != null) { result.ErrMsg = "登录账号不能重复"; return(ToJsonContent(result)); } } else { result.ErrMsg = "登录账号不能为空"; return(ToJsonContent(result)); } Tenant tenant = new Tenant(); tenant.Id = GuidUtils.CreateNo(); tenant.TenantName = info.Account; tenant.Email = info.Email; tenant.CreatorTime = DateTime.Now; tenant.EnabledMark = true; tenant.DeleteMark = false; TenantLogon tenantLogon = new TenantLogon(); tenantLogon.TenantPassword = info.Password; tenantLogon.AllowStartTime = tenantLogon.LockEndDate = tenantLogon.LockStartDate = tenantLogon.ChangePasswordDate = DateTime.Now; tenantLogon.AllowEndTime = DateTime.Now.AddYears(100); tenantLogon.MultiUserLogin = tenantLogon.CheckIPAddress = false; tenantLogon.LogOnCount = 0; result.Success = await iService.InsertAsync(tenant, tenantLogon); if (result.Success) { yuebonCacheHelper.Remove("ValidateCode"); result.ErrCode = ErrCode.successCode; result.ErrMsg = ErrCode.err0; } else { result.ErrMsg = ErrCode.err43001; result.ErrCode = "43001"; } return(ToJsonContent(result)); }
public void OnBeforeSerialize() { SerializedGuid = GuidUtils.GuidToSerializedGuid(m_id); }
public byte[] CombineUtils() => GuidUtils.Combine(_a, _b).ToByteArray();
public void RegisterProfile(CredentialProfile profile) { if (profile.CanCreateAWSCredentials || profile.Options.IsEmpty) { var reservedProperties = new Dictionary <string, string>(); if (profile.CanCreateAWSCredentials) { // set profile type field for backward compatibility SetProfileTypeField(reservedProperties, profile.ProfileType.Value); } if (profile.Region != null) { reservedProperties[RegionField] = profile.Region.SystemName; } if (profile.EndpointDiscoveryEnabled != null) { reservedProperties[EndpointDiscoveryEnabledField] = profile.EndpointDiscoveryEnabled.Value.ToString().ToLowerInvariant(); } if (profile.StsRegionalEndpoints != null) { reservedProperties[StsRegionalEndpointsField] = profile.StsRegionalEndpoints.ToString().ToLowerInvariant(); } if (profile.S3UseArnRegion != null) { reservedProperties[S3UseArnRegionField] = profile.S3UseArnRegion.Value.ToString().ToLowerInvariant(); } if (profile.S3RegionalEndpoint != null) { reservedProperties[S3RegionalEndpointField] = profile.S3RegionalEndpoint.ToString().ToLowerInvariant(); } if (profile.RetryMode != null) { reservedProperties[RetryModeField] = profile.RetryMode.ToString().ToLowerInvariant(); } if (profile.MaxAttempts != null) { reservedProperties[MaxAttemptsField] = profile.MaxAttempts.ToString().ToLowerInvariant(); } var profileDictionary = PropertyMapping.CombineProfileParts( profile.Options, ReservedPropertyNames, reservedProperties, profile.Properties); // Set the UniqueKey. It might change if the unique key is set by the objectManger, // or if this is an update to an existing profile. string newUniqueKeyStr = _settingsManager.RegisterObject(profile.Name, profileDictionary); Guid? newUniqueKey; if (GuidUtils.TryParseNullableGuid(newUniqueKeyStr, out newUniqueKey)) { profile.UniqueKey = newUniqueKey; } profile.CredentialProfileStore = this; } else { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "Unable to register profile {0}. The CredentialProfileOptions provided is not valid.", profile.Name)); } }
public virtual void OnAfterDeserialize() { ThemeId = GuidUtils.SerializedGuidToGuid(ThemeIdSerializedGuid); VariantId = GuidUtils.SerializedGuidToGuid(VariantIdSerializedGuid); PropertyId = GuidUtils.SerializedGuidToGuid(PropertyIdSerializedGuid); }
/// <summary> /// Get the profile with the name given, if it exists in this store. /// </summary> /// <param name="profileName">The name of the profile to find.</param> /// <param name="profile">The profile, if it was found, null otherwise</param> /// <returns>True if the profile was found, false otherwise.</returns> public bool TryGetProfile(string profileName, out CredentialProfile profile) { Dictionary <string, string> properties; string uniqueKeyStr; if (settingsManager.TryGetObject(profileName, out uniqueKeyStr, out properties)) { try { CredentialProfileOptions profileOptions; Dictionary <string, string> userProperties; Dictionary <string, string> reservedProperties; PropertyMapping.ExtractProfileParts(properties, ReservedPropertyNames, out profileOptions, out reservedProperties, out userProperties); string regionString; RegionEndpoint region = null; if (reservedProperties.TryGetValue(RegionField, out regionString)) { region = RegionEndpoint.GetBySystemName(regionString); } Guid?uniqueKey = null; if (!GuidUtils.TryParseNullableGuid(uniqueKeyStr, out uniqueKey)) { profile = null; return(false); } string endpointDiscoveryEnabledString; bool? endpointDiscoveryEnabled = null; if (reservedProperties.TryGetValue(EndpointDiscoveryEnabledField, out endpointDiscoveryEnabledString)) { bool endpointDiscoveryEnabledOut; if (!bool.TryParse(endpointDiscoveryEnabledString, out endpointDiscoveryEnabledOut)) { profile = null; return(false); } endpointDiscoveryEnabled = endpointDiscoveryEnabledOut; } profile = new CredentialProfile(profileName, profileOptions) { UniqueKey = uniqueKey, Properties = userProperties, Region = region, CredentialProfileStore = this, EndpointDiscoveryEnabled = endpointDiscoveryEnabled }; return(true); } catch (ArgumentException) { profile = null; return(false); } } else { profile = null; return(false); } }
public virtual void OnBeforeSerialize() { ThemeIdSerializedGuid = GuidUtils.GuidToSerializedGuid(ThemeId); VariantIdSerializedGuid = GuidUtils.GuidToSerializedGuid(VariantId); PropertyIdSerializedGuid = GuidUtils.GuidToSerializedGuid(PropertyId); }
public virtual void LoadFromXML(XElement xml) { Name = XmlUtilits.GetFieldValue(xml, "Name", "ERROR"); GUID = GuidUtils.GetGuid(XmlUtilits.GetFieldValue(xml, "GUID", ""), false); }
private static string ExtractCatalogId(string id) { var strArray = id.Split(new[] { "-" }, StringSplitOptions.RemoveEmptyEntries); return(strArray.Length < 3 ? string.Empty : GuidUtils.GetDeterministicGuidString($"{CommerceEntity.IdPrefix<Catalog>()}{strArray[2]}")); }
protected void Page_Load(object sender, EventArgs e) { this.orderNumber = GuidUtils.GetLongStringGuid(); this.orderDate = DateTime.Now.ToString("yyyyMMdd"); }
private async Task UpsertSellableItem(SellableItem item, CommercePipelineExecutionContext context) { if (string.IsNullOrEmpty(item.ProductId)) { item.ProductId = item.Id.SimplifyEntityName().ProposeValidId(); } if (string.IsNullOrEmpty(item.FriendlyId)) { item.FriendlyId = item.Id.SimplifyEntityName(); } if (string.IsNullOrEmpty(item.SitecoreId)) { item.SitecoreId = GuidUtils.GetDeterministicGuidString(item.Id); } var entity = await _findEntityPipeline.Run(new FindEntityArgument(typeof(SellableItem), item.Id), context); if (entity == null) { await _persistEntityPipeline.Run(new PersistEntityArgument(item), context); return; } if (!(entity is SellableItem)) { return; } var existingSellableItem = entity as SellableItem; // Try to merge the items. existingSellableItem.Name = item.Name; foreach (var policy in item.Policies) { if (existingSellableItem.HasPolicy(policy.GetType())) { existingSellableItem.RemovePolicy(policy.GetType()); } existingSellableItem.SetPolicy(policy); } if (item.HasComponent <ItemVariationsComponent>()) { var variations = existingSellableItem.GetComponent <ItemVariationsComponent>(); foreach (var variation in item.GetComponent <ItemVariationsComponent>().ChildComponents.OfType <ItemVariationComponent>()) { var existingVariation = existingSellableItem.GetVariation(variation.Id); if (existingVariation != null) { existingVariation.Name = variation.Name; foreach (var policy in variation.Policies) { if (existingVariation.Policies.Any(x => x.GetType() == policy.GetType())) { existingVariation.RemovePolicy(policy.GetType()); } existingVariation.SetPolicy(policy); } } else { variations.ChildComponents.Add(variation); } } } await _persistEntityPipeline.Run(new PersistEntityArgument(existingSellableItem), context); }
/// <summary> /// Get the profile with the name given, if it exists in this store. /// </summary> /// <param name="profileName">The name of the profile to find.</param> /// <param name="profile">The profile, if it was found, null otherwise</param> /// <returns>True if the profile was found, false otherwise.</returns> public bool TryGetProfile(string profileName, out CredentialProfile profile) { Dictionary <string, string> properties; string uniqueKeyStr; if (_settingsManager.TryGetObject(profileName, out uniqueKeyStr, out properties)) { try { CredentialProfileOptions profileOptions; Dictionary <string, string> userProperties; Dictionary <string, string> reservedProperties; PropertyMapping.ExtractProfileParts(properties, ReservedPropertyNames, out profileOptions, out reservedProperties, out userProperties); string regionString; RegionEndpoint region = null; if (reservedProperties.TryGetValue(RegionField, out regionString)) { region = RegionEndpoint.GetBySystemName(regionString); } Guid?uniqueKey = null; if (!GuidUtils.TryParseNullableGuid(uniqueKeyStr, out uniqueKey)) { profile = null; return(false); } string endpointDiscoveryEnabledString; bool? endpointDiscoveryEnabled = null; if (reservedProperties.TryGetValue(EndpointDiscoveryEnabledField, out endpointDiscoveryEnabledString)) { bool endpointDiscoveryEnabledOut; if (!bool.TryParse(endpointDiscoveryEnabledString, out endpointDiscoveryEnabledOut)) { profile = null; return(false); } endpointDiscoveryEnabled = endpointDiscoveryEnabledOut; } StsRegionalEndpointsValue?stsRegionalEndpoints = null; if (reservedProperties.TryGetValue(StsRegionalEndpointsField, out var stsRegionalEndpointsString)) { #if BCL35 try { stsRegionalEndpoints = (StsRegionalEndpointsValue)Enum.Parse(typeof(StsRegionalEndpointsValue), stsRegionalEndpointsString, true); } catch (Exception) { profile = null; return(false); } #else if (!Enum.TryParse <StsRegionalEndpointsValue>(stsRegionalEndpointsString, true, out var tempStsRegionalEndpoints)) { profile = null; return(false); } stsRegionalEndpoints = tempStsRegionalEndpoints; #endif } string s3UseArnRegionString; bool? s3UseArnRegion = null; if (reservedProperties.TryGetValue(S3UseArnRegionField, out s3UseArnRegionString)) { bool s3UseArnRegionOut; if (!bool.TryParse(s3UseArnRegionString, out s3UseArnRegionOut)) { profile = null; return(false); } s3UseArnRegion = s3UseArnRegionOut; } S3UsEast1RegionalEndpointValue?s3RegionalEndpoint = null; if (reservedProperties.TryGetValue(S3RegionalEndpointField, out var s3RegionalEndpointString)) { #if BCL35 try { s3RegionalEndpoint = (S3UsEast1RegionalEndpointValue)Enum.Parse(typeof(S3UsEast1RegionalEndpointValue), s3RegionalEndpointString, true); } catch (Exception) { profile = null; return(false); } #else if (!Enum.TryParse <S3UsEast1RegionalEndpointValue>(s3RegionalEndpointString, true, out var tempS3RegionalEndpoint)) { profile = null; return(false); } s3RegionalEndpoint = tempS3RegionalEndpoint; #endif } RequestRetryMode?requestRetryMode = null; if (reservedProperties.TryGetValue(RetryModeField, out var retryModeString)) { #if BCL35 try { requestRetryMode = (RequestRetryMode)Enum.Parse(typeof(RequestRetryMode), retryModeString, true); } catch (Exception) { profile = null; return(false); } #else if (!Enum.TryParse <RequestRetryMode>(retryModeString, true, out var tempRetryMode)) { profile = null; return(false); } requestRetryMode = tempRetryMode; #endif } int?maxAttempts = null; if (reservedProperties.TryGetValue(MaxAttemptsField, out var maxAttemptsString)) { if (!int.TryParse(maxAttemptsString, out var maxAttemptsTemp) || maxAttemptsTemp <= 0) { Logger.GetLogger(GetType()).InfoFormat("Invalid value {0} for {1} in profile {2}. A positive integer is expected.", maxAttemptsString, MaxAttemptsField, profileName); profile = null; return(false); } maxAttempts = maxAttemptsTemp; } profile = new CredentialProfile(profileName, profileOptions) { UniqueKey = uniqueKey, Properties = userProperties, Region = region, CredentialProfileStore = this, EndpointDiscoveryEnabled = endpointDiscoveryEnabled, StsRegionalEndpoints = stsRegionalEndpoints, S3UseArnRegion = s3UseArnRegion, S3RegionalEndpoint = s3RegionalEndpoint, RetryMode = requestRetryMode, MaxAttempts = maxAttempts }; return(true); } catch (ArgumentException) { profile = null; return(false); } } else { profile = null; return(false); } }
/// <summary> /// 默认构造函数(需要初始化属性的在此处理) /// </summary> public RoleAuthorize() { this.Id = GuidUtils.CreateNo(); }
/// <summary> /// 创建默认的主键值 /// </summary> public override void GenerateDefaultKeyVal() { Id = GuidUtils.CreateNo().CastTo <TKey>(); }
protected void Application_AcquireRequestState(Object sender, EventArgs e) { Context.Items["osCurrentPTAName"] = RequestPtaName; Context.Items["osCurrentPTAUserName"] = RequestPtaUserName; Context.Items["osIsLoadingScreen"] = false; RunningInfo.InitializeRunningInfo(); RunningInfo.ESpaceHash = ConfigurationManager.AppSettings["OutSystems.HubEdition.EspaceCompilationHash"]; RunningInfo.ESpaceVersionToken = ConfigurationManager.AppSettings["OutSystems.HubEdition.EspaceVersionToken"]; RunningInfo.ESpaceVersionId = int.Parse(ConfigurationManager.AppSettings["OutSystems.HubEdition.EspaceVersionID"]); RunningInfo.DebugMode = false; // Skips internal pages if (Request.FilePath.ToLowerInvariant().EndsWith("/_ping.aspx") || Request.FilePath.ToLowerInvariant().EndsWith("/_queriescoverage.aspx") || Request.FilePath.ToLower().EndsWith("/_debugger.asmx") || Request.FilePath.ToLower().EndsWith("/_debuggerevents.ashx")) { return; } if (App == null) { // Try again Application_Start(sender, e); if (Application["ApplicationStartError"] != null) { ApplicationStartErrorRedirect(); } } // Session Start HeContext heContext = Global.App.OsContext; heContext.InitSession(); HttpCookie sessionCookie = null; var sessionCookieKey = Response.Cookies.AllKeys.FirstIfSingleOrDefault(c => c == CookieActions.GetSessionCookieName()); if (sessionCookieKey == null) { sessionCookieKey = Request.Cookies.AllKeys.FirstIfSingleOrDefault(c => c == CookieActions.GetSessionCookieName()); if (sessionCookieKey != null) { sessionCookie = Request.Cookies.Get(sessionCookieKey); } } else { sessionCookie = Response.Cookies.Get(sessionCookieKey); } if (sessionCookie != null) { sessionCookie.Secure = RuntimePlatformSettings.Authentication.EnforceSessionCookiesSecure.GetValue(); sessionCookie.HttpOnly = true; Response.Cookies.Set(sessionCookie); } if (Context.Session == null || heContext.Session.NeedsSessionStart(App.eSpaceName)) { Global.App.OsContext.Session["TerminalType"] = "WEB"; Global.App.OsContext.Session["MSISDN"] = ""; if (Application["ApplicationStartError"] != null) { // Try again Application_Start(sender, e); } if (Application["ApplicationStartError"] != null) { ApplicationStartErrorRedirect(); } if (Context.Session != null) { ExtendedActions.AutoLogin(App, App.OsContext.Session); RunOnSessionStart(); } } /* * else { * * } */ // Process visit cookies if (RuntimePlatformUtils.ShouldCreateCookieForRequest()) { if (Request.CurrentExecutionFilePath.ToLowerInvariant().EndsWith(".aspx")) { var osVisitorCookie = Request.Cookies["osVisitor"]; var osVisitCookie = Request.Cookies["osVisit"]; if (osVisitorCookie == null || !GuidUtils.IsGuid(osVisitorCookie.Value)) { osVisitorCookie = new HttpCookie("osVisitor", Guid.NewGuid().ToString()); } osVisitorCookie.Expires = DateTime.Now.AddYears(100); // forever SecureCookieUtils.setSecureCookie(osVisitorCookie, heContext.Context.Response); if (osVisitCookie == null || !GuidUtils.IsGuid(osVisitCookie.Value)) { osVisitCookie = new HttpCookie("osVisit", Guid.NewGuid().ToString()); heContext.Session["osIsNewVisit"] = true; } osVisitCookie.Expires = DateTime.Now.AddMinutes(30); SecureCookieUtils.setSecureCookie(osVisitCookie, heContext.Context.Response); Context.Items["osVisitor"] = osVisitorCookie.Value; Context.Items["osVisit"] = osVisitCookie.Value; } } App.OsContext.Session[GenericExtendedActions.ReqAuditCountSessionName] = 0; // Default Multilingual state if (!App.MultilingualEnabled) { GenericExtendedActions.SetCurrentLocale(heContext, ""); } else { string localeHeader = heContext.OsISAPIFilter.GetLocale(Request); if (localeHeader != null) { try { GenericExtendedActions.SetCurrentLocale(heContext, localeHeader); } catch {} } } }