コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 internal static Uri TryParseUri(string uriString)
 {
     return(UrlUtilities.TryParseUri(uriString, UriKind.Absolute));
 }