private static bool RedirectBecauseClientForgotTrailingSlashOnRoot(HttpApplication httpApplication, HttpContext httpContext, Uri originalUri) { bool result = false; HttpRequest request = httpContext.Request; if (request.HttpMethod == "GET") { string absolutePath = originalUri.AbsolutePath; string rootWithSlash = RequestDispatcher.GetRootWithSlash(); string value = rootWithSlash.TrimEnd(new char[] { '/' }); if (absolutePath.Equals(value, StringComparison.OrdinalIgnoreCase)) { if (string.IsNullOrEmpty(originalUri.Query) && OfflineClientRequestUtilities.IsRequestForAppCachedVersion(httpContext)) { RequestDispatcher.SendJavascriptRedirectTo(httpApplication, httpContext.Response, rootWithSlash); result = true; } else { RequestDispatcher.Send301RedirectTo(httpContext.Response, rootWithSlash + originalUri.Query); result = true; } } } return(result); }
private static bool RedirectBecauseClientRequestedWebsiteRoot(HttpApplication httpApplication, HttpContext httpContext, Uri originalUri) { bool result = false; HttpRequest request = httpContext.Request; if (request.HttpMethod == "GET") { string absolutePath = originalUri.AbsolutePath; string rootWithSlash = RequestDispatcher.GetRootWithSlash(); if (string.IsNullOrEmpty(absolutePath) || absolutePath.Equals("/", StringComparison.OrdinalIgnoreCase)) { RequestDispatcher.SendJavascriptRedirectTo(httpApplication, httpContext.Response, rootWithSlash + originalUri.Query); result = true; } } return(result); }
private static bool RedirectBecauseClientRequestedOwaRootSlashRealm(HttpApplication httpApplication, HttpContext httpContext, Uri originalUri) { bool result = false; HttpRequest request = httpContext.Request; if (request.HttpMethod == "GET") { string rootWithSlash = RequestDispatcher.GetRootWithSlash(); string absolutePath = originalUri.AbsolutePath; string text = httpContext.Request.QueryString["realm"] ?? string.Empty; if (!string.IsNullOrEmpty(text)) { string text2 = Uri.EscapeDataString(text.ToLowerInvariant()); if (absolutePath.Equals(rootWithSlash + text2, StringComparison.OrdinalIgnoreCase) || absolutePath.Equals(rootWithSlash + text2 + "/", StringComparison.OrdinalIgnoreCase)) { string str = string.IsNullOrEmpty(originalUri.Query) ? "?" : (originalUri.Query + "&"); string str2 = string.Format("{0}={1}", "realm", text2); RequestDispatcher.SendJavascriptRedirectTo(httpApplication, httpContext.Response, rootWithSlash + str + str2); result = true; } } } return(result); }