protected override void OnLoad(EventArgs e) { ErrorFE.FEErrorCodes feerrorCodes = ErrorFE.FEErrorCodes.Unknown; string text = null; if (HttpContext.Current != null && HttpContext.Current.Items != null) { if (HttpContext.Current.Items.Contains("CafeError")) { feerrorCodes = (ErrorFE.FEErrorCodes)HttpContext.Current.Items["CafeError"]; } if (HttpContext.Current.Items.Contains("redirectUrl")) { text = (HttpContext.Current.Items["redirectUrl"] as string); } } string s; int httpCode; if (string.IsNullOrEmpty(s = HttpContext.Current.Request.QueryString["httpCode"]) || !int.TryParse(s, out httpCode)) { if (!string.IsNullOrEmpty(text)) { httpCode = 302; } else { httpCode = 500; } } bool sharePointApp; if (!bool.TryParse(HttpContext.Current.Request.QueryString["sharepointapp"], out sharePointApp)) { sharePointApp = false; } bool siteMailbox; if (!bool.TryParse(HttpContext.Current.Request.QueryString["sm"], out siteMailbox)) { siteMailbox = false; } ErrorMode value; if (!Enum.TryParse <ErrorMode>(HttpContext.Current.Request.QueryString["m"], out value)) { value = ErrorMode.Frowny; } string groupMailboxDestination = HttpContext.Current.Request.QueryString["gm"]; this.errorInformation = new Microsoft.Exchange.Clients.Owa.Core.ErrorInformation(httpCode, feerrorCodes.ToString(), sharePointApp); this.errorInformation.SiteMailbox = siteMailbox; this.errorInformation.GroupMailboxDestination = groupMailboxDestination; this.errorInformation.RedirectionUrl = text; this.errorInformation.ErrorMode = new ErrorMode?(value); this.isIE = (BrowserType.IE == Utilities.GetBrowserType(this.Context.Request.UserAgent)); this.CompileDiagnosticInfo(); this.AddDiagnosticsHeaders(); this.OnInit(e); }
public static void TransferToErrorPage(HttpContext httpContext, ErrorFE.FEErrorCodes errorCode) { ExTraceGlobals.VerboseTracer.TraceDebug <ErrorFE.FEErrorCodes>(0L, "[AspNetHelper.TransferToErrorPage] Transferring to error page with error code {0}", errorCode); if (httpContext == null) { throw new ArgumentNullException("httpContext"); } httpContext.Items["CafeError"] = errorCode; httpContext.Server.Transfer(OwaUrl.CafeErrorPage.ImplicitUrl); }