protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { LinkedInConfig linkedInConfig = this.ReadConfiguration(); LinkedInAppConfig config = this.ReadAppConfiguration(); LinkedInAppAuthorizationResponse response = new LinkedInAuthenticator(linkedInConfig, new LinkedInWebClient(config, LinkedInSetup.Tracer), LinkedInSetup.Tracer).AuthorizeApplication(base.Request.QueryString, base.Request.Cookies, base.Response.Cookies, this.GetAuthorizationCallbackUrl()); this.ProcessAuthorizationResponse(response); } catch (ExchangeConfigurationException ex) { EcpEventLogConstants.Tuple_BadLinkedInConfiguration.LogPeriodicEvent(EcpEventLogExtensions.GetPeriodicKeyPerUser(), new object[] { EcpEventLogExtensions.GetUserNameToLog(), ex }); ErrorHandlingUtil.TransferToErrorPage("badlinkedinconfiguration"); } catch (LinkedInAuthenticationException ex2) { EcpEventLogConstants.Tuple_LinkedInAuthorizationError.LogEvent(new object[] { EcpEventLogExtensions.GetUserNameToLog(), ex2 }); ErrorHandlingUtil.TransferToErrorPage("linkedinauthorizationerror"); } }
public static void ShowServerErrors(ErrorInformationBase[] errorInfos, System.Web.UI.Page page) { if (errorInfos != null && errorInfos.Length > 0) { ErrorHandlingUtil.ShowServerErrors(errorInfos.ToInfos(), page); } }
private void DisplayResults <T>(PowerShellResults <T> results) where T : PimSubscription { if (results.Failed) { if (results.ErrorRecords[0].Exception is ManagementObjectNotFoundException) { ErrorHandlingUtil.TransferToErrorPage("liveidmismatch"); return; } if (results.ErrorRecords[0].Exception is ValidateSecretFailureException) { ErrorHandlingUtil.TransferToErrorPage("verificationfailed"); return; } ErrorHandlingUtil.TransferToErrorPage("verificationprocessingerror"); return; } else { if (results.Output.Length == 0) { ErrorHandlingUtil.TransferToErrorPage("verificationprocessingerror"); return; } this.msgText.Text = OwaOptionStrings.VerificationSuccessText(results.Output[0].EmailAddress); base.Title = OwaOptionStrings.VerificationSuccessPageTitle; return; } }
protected override void OnLoad(EventArgs e) { this.EnableViewState = true; base.OnLoad(e); if (base.IsPostBack) { if (string.Compare(this.SenderButtonId, base.CommitButtonClientID) != 0 && string.Compare(this.SenderButtonId, base.BackButton.ClientID) != 0 && string.Compare(this.SenderButtonId, base.NextButton.ClientID) != 0) { this.ShowDisabledWizard(Strings.WebServiceErrorMessage); return; } } else { Exception lastError = base.Server.GetLastError(); if (lastError != null) { InfoCore infoCore = lastError.ToErrorInformationBase().ToInfo(); if (lastError.IsMaxRequestLengthExceededException()) { infoCore.Message = Strings.MigrationFileTooBig; infoCore.Details = string.Empty; base.Server.ClearError(); } ErrorHandlingUtil.ShowServerError(infoCore, this.Page); } } }
protected void ShowDisabledWizard(string reason) { this.IsInError = true; base.NextButton.Disabled = true; base.BackButton.Disabled = true; base.CommitButton.Disabled = true; ErrorHandlingUtil.ShowServerError(reason, string.Empty, this.Page); }
public static void ShowServerError(InfoCore errorInfo, System.Web.UI.Page page) { if (errorInfo != null) { ErrorHandlingUtil.ShowServerErrors(new InfoCore[] { errorInfo }, page); } }
private static void Application_PostAcquireRequestState(object sender, EventArgs e) { if (!VirtualDirectoryConfiguration.EcpVirtualDirectoryAnonymousAuthenticationEnabled) { ExTraceGlobals.RBACTracer.TraceInformation(0, 0L, "Anonymous authentication must be enabled in ECP."); throw new ExchangeConfigurationException(Strings.AnonymousAuthenticationDisabledErrorMessage); } HttpRequest request = HttpContext.Current.Request; HttpBrowserCapabilities browser = request.Browser; if (browser != null && browser.IsBrowser("IE") && browser.MajorVersion < 7) { ErrorHandlingUtil.TransferToErrorPage("browsernotsupported"); } }
public static void SendReportForCriticalException(HttpContext context, Exception exception) { if (exception.IsUICriticalException() && exception.IsControlPanelException()) { ExWatson.AddExtraData(ErrorHandlingUtil.GetEcpWatsonExtraData(context, exception)); EcpPerfCounters.SendWatson.Increment(); RbacPrincipal rbacPrincipal = context.User as RbacPrincipal; if (rbacPrincipal != null && ExTraceConfiguration.Instance.InMemoryTracingEnabled) { TroubleshootingContext troubleshootingContext = rbacPrincipal.RbacConfiguration.TroubleshootingContext; troubleshootingContext.SendTroubleshootingReportWithTraces(exception, ErrorHandlingUtil.GetEcpWatsonTitle(exception, context)); return; } ExWatson.SendReport(exception, ReportOptions.ReportTerminateAfterSend, exception.GetCustomMessage()); } }
private InboxRule GetMessageInfo(string messageId) { InboxRules inboxRules = base.RuleService as InboxRules; PowerShellResults <InboxRule> mailMessage = inboxRules.GetMailMessage(new NewInboxRule { FromMessageId = new Identity(messageId, messageId), ValidateOnly = new bool?(true), AllowExceuteThruHttpGetRequest = true }); if (mailMessage.Failed) { string cause = (mailMessage.ErrorRecords[0].Exception is ManagementObjectNotFoundException) ? "messagenotfound" : "unexpected"; ErrorHandlingUtil.TransferToErrorPage(cause); } return(mailMessage.Value); }
private void Application_PostAuthenticateRequest(object sender, EventArgs e) { HttpContext httpContext = HttpContext.Current; string text = httpContext.Request.Headers["msExchProxyUri"]; if (!string.IsNullOrEmpty(text)) { Uri uri = new Uri(text); string text2 = (uri.Segments.Length > 1) ? uri.Segments[1].TrimEnd(new char[] { '/' }) : string.Empty; if (text2.Equals(RbacModule.ecpAppPath.Value, StringComparison.OrdinalIgnoreCase) && !text2.Equals(RbacModule.ecpAppPath.Value)) { string url = "/" + RbacModule.ecpAppPath + uri.PathAndQuery.Substring(RbacModule.ecpAppPath.Value.Length + 1); httpContext.Response.Redirect(url, true); return; } } if (httpContext.Request.HttpMethod == "GET" && !RbacModule.bypassXFrameOptions && !RbacModule.xFrameOptionsExceptionList.Contains(httpContext.Request.AppRelativeCurrentExecutionFilePath)) { httpContext.Response.Headers.Set("X-Frame-Options", "SameOrigin"); } AuthenticationSettings authenticationSettings = new AuthenticationSettings(httpContext); httpContext.User = authenticationSettings.Session; authenticationSettings.Session.SetCurrentThreadPrincipal(); if (!httpContext.IsAcsOAuthRequest()) { httpContext.CheckCanary(); } authenticationSettings.Session.RequestReceived(); if (authenticationSettings.Session is RbacPrincipal) { if (!OAuthHelper.IsWebRequestAllowed(httpContext)) { ErrorHandlingUtil.TransferToErrorPage("notavailableforpartner"); } if (!LoginUtil.CheckUrlAccess(httpContext.Request.FilePath)) { ErrorHandlingUtil.TransferToErrorPage("noroles"); return; } this.FlightRewrite(httpContext); } }
private void ImportContactsRequest() { if (base.Request.Files.Count == 0 || string.IsNullOrEmpty(base.Request.Files[0].FileName)) { this.currentPage = ImportContactListForm.ImportContactListPageState.UploadCsvFilePage; ErrorHandlingUtil.ShowServerError(OwaOptionStrings.ImportContactListNoFileUploaded, string.Empty, this.Page); return; } HttpPostedFile httpPostedFile = base.Request.Files[0]; this.filename = string.Empty; try { this.filename = Path.GetFileName(httpPostedFile.FileName); } catch (ArgumentException) { this.filename = null; } if (string.IsNullOrEmpty(this.filename)) { this.currentPage = ImportContactListForm.ImportContactListPageState.UploadCsvFilePage; ErrorHandlingUtil.ShowServerError(OwaOptionClientStrings.FileUploadFailed, string.Empty, this.Page); return; } ImportContactListParameters importContactListParameters = new ImportContactListParameters(); importContactListParameters.CSVStream = httpPostedFile.InputStream; ImportContactList importContactList = new ImportContactList(); PowerShellResults <ImportContactsResult> powerShellResults = importContactList.ImportObject(Identity.FromExecutingUserId(), importContactListParameters); if (!powerShellResults.Failed) { this.importResult = powerShellResults.Output[0]; this.currentPage = ImportContactListForm.ImportContactListPageState.ImportContactListResultPage; return; } this.currentPage = ImportContactListForm.ImportContactListPageState.UploadCsvFilePage; if (powerShellResults.ErrorRecords[0].Exception is ImportContactsException) { ErrorHandlingUtil.ShowServerError(powerShellResults.ErrorRecords[0].Message, string.Empty, this.Page); return; } ErrorHandlingUtil.ShowServerErrors(powerShellResults.ErrorRecords, this.Page); }
public ErrorInformationBase(Exception exception) { this.Exception = exception; if (string.IsNullOrEmpty(this.Message)) { this.Message = exception.Message; } if (ErrorHandlingUtil.CanShowDebugInfo(this.Exception)) { this.CallStack = this.Exception.ToTraceString(); } IExceptionDetails exceptionDetails = this.Exception as IExceptionDetails; if (exceptionDetails != null) { this.Details = exceptionDetails.Details; } }
protected override void OnLoad(EventArgs e) { string subscriptionTypeParam = this.Context.Request.QueryString["st"]; string subscriptionGuidParam = this.Context.Request.QueryString["su"]; string text = this.Context.Request.QueryString["ss"]; AggregationSubscriptionType aggregationSubscriptionType; Guid subscriptionId; string queryParam; if (!this.ValidateUrlParameters(subscriptionTypeParam, subscriptionGuidParam, text, out aggregationSubscriptionType, out subscriptionId, out queryParam)) { throw new BadQueryParameterException(queryParam); } ADObjectId executingUserId = RbacPrincipal.Current.ExecutingUserId; AggregationSubscriptionIdentity subId = new AggregationSubscriptionIdentity(executingUserId, subscriptionId); AggregationSubscriptionIdParameter aggregationSubscriptionIdParameter = new AggregationSubscriptionIdParameter(subId); string text2 = aggregationSubscriptionIdParameter.ToString(); if (text2 == null) { ErrorHandlingUtil.TransferToErrorPage("unexpected"); return; } if (aggregationSubscriptionType == AggregationSubscriptionType.Pop) { PopSubscriptions popSubscriptions = new PopSubscriptions(); SetPopSubscription setPopSubscription = new SetPopSubscription(); setPopSubscription.ValidateSecret = text; setPopSubscription.AllowExceuteThruHttpGetRequest = true; Identity identity = new Identity(text2, text2); PowerShellResults <PopSubscription> results = popSubscriptions.SetObject(identity, setPopSubscription); this.DisplayResults <PopSubscription>(results); return; } ImapSubscriptions imapSubscriptions = new ImapSubscriptions(); SetImapSubscription setImapSubscription = new SetImapSubscription(); setImapSubscription.ValidateSecret = text; setImapSubscription.AllowExceuteThruHttpGetRequest = true; Identity identity2 = new Identity(text2, text2); PowerShellResults <ImapSubscription> results2 = imapSubscriptions.SetObject(identity2, setImapSubscription); this.DisplayResults <ImapSubscription>(results2); }
protected override void OnLoad(EventArgs e) { string a; if ((a = this.Provider.ToLowerInvariant()) != null) { if (a == "facebook") { base.Server.Transfer("~/Connect/FacebookSetup.aspx"); return; } if (a == "linkedin") { base.Server.Transfer("~/Connect/LinkedInSetup.aspx"); return; } } ErrorHandlingUtil.TransferToErrorPage("badrequesttopeopleconnectmainbadproviderparameter"); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { this.ctlUserConsentForm.Visible = false; FacebookAuthenticatorConfig config = this.ReadConfiguration(); FacebookAuthenticator facebookAuthenticator = new FacebookAuthenticator(config); AppAuthorizationResponse response = FacebookAuthenticator.ParseAppAuthorizationResponse(base.Request.QueryString); if (!FacebookAuthenticator.IsRedirectFromFacebook(response)) { string text = facebookAuthenticator.GetAppAuthorizationUri().ToString(); if (this.IsReconnect()) { base.Response.Redirect(text); } else { this.ctlUserConsentForm.Visible = true; this.ctlUserConsentForm.AuthorizationUrl = text; } } else if (facebookAuthenticator.IsAuthorizationGranted(response)) { this.ProcessAuthorizationGranted(response); } else { this.ProcessAuthorizationDenied(); } } catch (ExchangeConfigurationException ex) { EcpEventLogConstants.Tuple_BadFacebookConfiguration.LogPeriodicEvent(EcpEventLogExtensions.GetPeriodicKeyPerUser(), new object[] { EcpEventLogExtensions.GetUserNameToLog(), ex }); ErrorHandlingUtil.TransferToErrorPage("badfacebookconfiguration"); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); this.InstallMarketplaceAssetID = this.Context.Request.QueryString["AssetID"]; this.MarketplaceQueryMarket = this.Context.Request.QueryString["LC"]; this.Scope = this.Context.Request.QueryString["Scope"]; this.DeploymentId = this.Context.Request.QueryString["DeployId"]; this.Etoken = this.GetClientTokenParameter(this.Context.Request.RawUrl); if (!string.IsNullOrWhiteSpace(this.InstallMarketplaceAssetID) && !string.IsNullOrWhiteSpace(this.MarketplaceQueryMarket)) { return; } EcpEventLogConstants.Tuple_MissingRequiredParameterDetected.LogPeriodicEvent(EcpEventLogExtensions.GetPeriodicKeyPerUser(), new object[] { EcpEventLogExtensions.GetUserNameToLog(), this.Context.GetRequestUrlForLog(), (this.InstallMarketplaceAssetID != null) ? this.InstallMarketplaceAssetID : string.Empty, (this.MarketplaceQueryMarket != null) ? this.MarketplaceQueryMarket : string.Empty }); ErrorHandlingUtil.TransferToErrorPage("badofficecallback"); }
private void ExecuteUpload() { try { if (base.Request.Files.Count == 0 || string.IsNullOrEmpty(base.Request.Files[0].FileName)) { ErrorHandlingUtil.ShowServerError(Strings.ISVNoFileUploaded, string.Empty, this.Page); } else { DLPISVService dlpisvservice = new DLPISVService(); HttpPostedFile httpPostedFile = base.Request.Files[0]; byte[] array = new byte[httpPostedFile.ContentLength]; httpPostedFile.InputStream.Read(array, 0, array.Length); PowerShellResults powerShellResults = dlpisvservice.ProcessUpload(new DLPNewPolicyUploadParameters { Mode = this.policyMode.SelectedValue, State = RuleState.Enabled.ToString(), Name = this.name.Text, Description = this.description.Text, TemplateData = array }); if (powerShellResults.Failed) { ErrorHandlingUtil.ShowServerErrors(powerShellResults.ErrorRecords, this.Page); } else { this.Page.RegisterStartupScript("windowclose", string.Format("<script>{0}</script>", "window.opener.RefreshPolicyListView();window.close();")); } } } catch (Exception ex) { ErrorHandlingUtil.ShowServerError(ex.Message, string.Empty, this.Page); } }
private static void Application_Error(object sender, EventArgs e) { HttpContext httpContext = HttpContext.Current; Exception ex = httpContext.GetError(); ExTraceGlobals.EventLogTracer.TraceError <EcpTraceFormatter <Exception> >(0, 0L, "Application Error: {0}", ex.GetTraceFormatter()); DDIHelper.Trace("Application Error: {0}", new object[] { ex.GetTraceFormatter() }); EcpPerfCounters.AspNetErrors.Increment(); EcpEventLogConstants.Tuple_RequestFailed.LogPeriodicFailure(EcpEventLogExtensions.GetUserNameToLog(), httpContext.GetRequestUrlForLog(), ex, EcpEventLogExtensions.GetFlightInfoForLog()); RbacPrincipal current = RbacPrincipal.GetCurrent(false); string tenantName = string.Empty; if (current != null) { OrganizationId organizationId = current.RbacConfiguration.OrganizationId; if (organizationId != null && organizationId.OrganizationalUnit != null) { tenantName = organizationId.OrganizationalUnit.Name; } } ActivityContextLogger.Instance.LogEvent(new PeriodicFailureEvent(ActivityContext.ActivityId.FormatForLog(), tenantName, httpContext.GetRequestUrlForLog(), ex, EcpEventLogExtensions.GetFlightInfoForLog())); ActivityContextManager.CleanupActivityContext(httpContext); if (ex is DelegatedSecurityTokenExpiredException) { ErrorHandlingModule.HandleDelegatedSecurityTokenExpire(httpContext); return; } if (httpContext.IsWebServiceRequest()) { string errorCause = DiagnosticsBehavior.GetErrorCause(ex); ErrorHandlingUtil.SendReportForCriticalException(httpContext, ex); ErrorHandlingModule.SendJsonError(httpContext, ex, errorCause); return; } if (httpContext.IsUploadRequest()) { ErrorHandlingUtil.SendReportForCriticalException(httpContext, ex); ErrorHandlingModule.SendJsonErrorForUpload(httpContext, ex); return; } if (ex is HttpException && ex.InnerException != null) { ex = ex.InnerException; } httpContext.Request.ServerVariables["X-ECP-ERROR"] = ex.GetType().FullName; string text = null; string text2 = null; if (ex is OverBudgetException) { text = "overbudget"; } else if (ex is IdentityNotMappedException || ex is TransientException) { text = "transientserviceerror"; } else if (ex is ObjectNotFoundException) { if (ex.InnerException is NonUniqueRecipientException) { text = "nonuniquerecipient"; } else { text = "nonmailbox"; } } else if (ex is ServerNotInSiteException || ex is LowVersionUserDeniedException) { text = "lowversion"; } else if (ex is CmdletAccessDeniedException || ex is DelegatedAccessDeniedException) { text = "noroles"; } else if (ex is UrlNotFoundOrNoAccessException) { text = "urlnotfoundornoaccess"; } else if (ex is BadRequestException) { text = "badrequest"; } else if (ex is BadQueryParameterException) { text = "badqueryparameter"; } else if (ex is ProxyFailureException) { text = "transientserviceerror"; } else if (ex is ProxyCantFindCasServerException) { text = "proxy"; } else if (ex is CasServerNotSupportEsoException) { text = "noeso"; } else if (ex is RegionalSettingsNotConfiguredException) { text = "regionalsettingsnotconfigured"; } else if (ex is SecurityException || (ErrorHandlingUtil.KnownReflectedExceptions.Value.ContainsKey("Microsoft.Exchange.Hygiene.Security.Authorization.NoValidRolesAssociatedToUserException, Microsoft.Exchange.Hygiene.Security.Authorization") && ex.GetType() == ErrorHandlingUtil.KnownReflectedExceptions.Value["Microsoft.Exchange.Hygiene.Security.Authorization.NoValidRolesAssociatedToUserException, Microsoft.Exchange.Hygiene.Security.Authorization"])) { text = "noroles"; } else if (ex is ExchangeConfigurationException) { text = "anonymousauthenticationdisabled"; } else if (ex is CannotAccessOptionsWithBEParamOrCookieException) { text = "cannotaccessoptionswithbeparamorcookie"; } else if (ex.IsMaxRequestLengthExceededException()) { EcpPerfCounters.RedirectToError.Increment(); text2 = httpContext.Request.AppRelativeCurrentExecutionFilePath; } else { ErrorHandlingUtil.SendReportForCriticalException(httpContext, ex); if (!ErrorHandlingUtil.ShowIisNativeErrorPage && !ex.IsInterestingHttpException()) { text = "unexpected"; } } if (text2 != null) { httpContext.Server.Transfer(text2, true); return; } if (text != null) { ErrorHandlingModule.TransferToErrorPage(text, ErrorHandlingUtil.CanShowDebugInfo(ex)); } }
bool IErrorHandler.HandleError(Exception error) { ErrorHandlingUtil.SendReportForCriticalException(HttpContext.Current, error); return(false); }
private static PowerShellResults InvokeAsyncCore(Func <PowerShellResults> callback, Action <PowerShellResults> onCompleted, string uniqueUserIdentity, AsyncServiceManager.AsyncTaskBudgetManager asyncTaskBudget, string commandStringForTrace, ThrottlingType throttlingType) { if (string.IsNullOrEmpty(uniqueUserIdentity)) { throw new ArgumentNullException("uniqueUserIdentity cannot be null."); } AsyncServiceManager.AsyncTaskThrottlingStatus asyncTaskThrottlingStatus = asyncTaskBudget.RegisterAsyncTask(uniqueUserIdentity, commandStringForTrace, throttlingType); if (asyncTaskThrottlingStatus != AsyncServiceManager.AsyncTaskThrottlingStatus.None) { LocalizedString value = (asyncTaskThrottlingStatus == AsyncServiceManager.AsyncTaskThrottlingStatus.PerAppThrottlingHit) ? Strings.LongRunPerAppThrottlingHit : Strings.LongRunPerUserThrottlingHit; asyncTaskBudget.UnregisterAsyncTask(uniqueUserIdentity, throttlingType); return(new PowerShellResults { ErrorRecords = new ErrorRecord[] { new ErrorRecord(new InvalidOperationException(value)) } }); } AsyncServiceManager.WorkItem workItem = new AsyncServiceManager.WorkItem(Guid.NewGuid().ToString()); AsyncServiceManager.workItems[workItem.Id] = workItem; CultureInfo currentCulture = CultureInfo.CurrentCulture; IPrincipal currentPrincipal = Thread.CurrentPrincipal; OperationContext currentOperationContext = OperationContext.Current; HttpContext currentHttpContext = HttpContext.Current; commandStringForTrace = ((commandStringForTrace == null) ? string.Empty : commandStringForTrace); RbacPrincipal rbacSession = RbacPrincipal.GetCurrent(false); ThreadPool.QueueUserWorkItem(delegate(object state) { int managedThreadId = Thread.CurrentThread.ManagedThreadId; AsyncServiceManager.WorkItem workItem; AsyncServiceManager.workerThreads[managedThreadId] = workItem; CultureInfo currentCulture = CultureInfo.CurrentCulture; IPrincipal currentPrincipal = Thread.CurrentPrincipal; OperationContext value2 = OperationContext.Current; HttpContext value3 = HttpContext.Current; Thread.CurrentThread.CurrentCulture = (Thread.CurrentThread.CurrentUICulture = currentCulture); Thread.CurrentPrincipal = currentPrincipal; OperationContext.Current = currentOperationContext; HttpContext.Current = AsyncServiceManager.CloneHttpContextForLongRunningThread(currentHttpContext); ActivityContextManager.InitializeActivityContext(HttpContext.Current, ActivityContextLoggerId.LongRunning); PowerShellResults powerShellResults = null; try { EcpEventLogConstants.Tuple_AsyncWebRequestStarted.LogEvent(new object[] { uniqueUserIdentity, managedThreadId, commandStringForTrace }); powerShellResults = callback(); object obj = AsyncServiceManager.workerThreads[managedThreadId]; } catch (Exception exception) { powerShellResults = new PowerShellResults(); powerShellResults.ErrorRecords = new ErrorRecord[] { new ErrorRecord(exception) }; EcpEventLogConstants.Tuple_AsyncWebRequestFailed.LogEvent(new object[] { uniqueUserIdentity, managedThreadId, exception.GetTraceFormatter(), commandStringForTrace }); ErrorHandlingUtil.SendReportForCriticalException(currentHttpContext, exception); DDIHelper.Trace("Async work item {0}, Error: {1}", new object[] { workItem.Id, exception.GetTraceFormatter() }); } finally { AsyncServiceManager.workerThreads.Remove(managedThreadId); lock (workItem) { workItem.Results = powerShellResults; ProgressRecord progressRecord = workItem.LegacyProgressRecord ?? ((workItem.ProgressCalculator == null) ? new ProgressRecord() : workItem.ProgressCalculator.ProgressRecord); powerShellResults.ProgressRecord = progressRecord; progressRecord.HasCompleted = true; progressRecord.IsCancelled = workItem.Cancelled; workItem.FinishedEvent.Set(); } asyncTaskBudget.UnregisterAsyncTask(uniqueUserIdentity, throttlingType); if (onCompleted != null) { onCompleted(powerShellResults); } EcpEventLogConstants.Tuple_AsyncWebRequestEnded.LogEvent(new object[] { uniqueUserIdentity, managedThreadId, commandStringForTrace }); ActivityContextManager.CleanupActivityContext(HttpContext.Current); Thread.CurrentThread.CurrentCulture = (Thread.CurrentThread.CurrentUICulture = currentCulture); Thread.CurrentPrincipal = currentPrincipal; OperationContext.Current = value2; HttpContext.Current = value3; GC.KeepAlive(rbacSession); } }); return(new PowerShellResults { ProgressId = workItem.Id }); }