public static Uri GetOriginalRequestUrlFromContext(HttpContext httpContext) { Uri result = httpContext.Request.Url; string text = httpContext.Request.Headers.Get("X-OWA-OriginalRequestUrl"); if (!string.IsNullOrEmpty(text)) { Uri uri = UrlUtilities.TryParseUri(HttpUtility.UrlDecode(text)); if (uri != null) { result = uri; } } return(result); }
internal static bool IsSafeUrl(string urlString) { if (string.IsNullOrEmpty(urlString)) { return(false); } Uri uri; if (null == (uri = UrlUtilities.TryParseUri(urlString))) { return(false); } string scheme = uri.Scheme; return(!string.IsNullOrEmpty(scheme) && Uri.CheckSchemeName(scheme) && TextConvertersInternalHelpers.IsUrlSchemaSafe(scheme)); }
internal static Uri TryParseUri(string uriString) { return(UrlUtilities.TryParseUri(uriString, UriKind.Absolute)); }