示例#1
0
 internal static bool TryGetRedirectUri(Uri uri, string canonicalHostname, out Uri redirectUri, out bool isVanityDomainRedirect)
 {
     redirectUri            = null;
     isVanityDomainRedirect = false;
     if (!HttpRedirectCommon.UriIsHttps(uri))
     {
         UriBuilder uriBuilder = new UriBuilder(uri);
         uriBuilder.Scheme = "https";
         uriBuilder.Port   = 443;
         if (string.IsNullOrEmpty(uriBuilder.Path) || uriBuilder.Path == "/")
         {
             uriBuilder.Path = "/owa/";
         }
         if (VanityDomainRedirectModule.IsMissingTrailingSlashRequired(uriBuilder.Path))
         {
             UriBuilder uriBuilder2 = uriBuilder;
             uriBuilder2.Path += "/";
         }
         if (VanityDomainRedirectModule.IsVanityDomain(uri, canonicalHostname))
         {
             isVanityDomainRedirect = true;
             uriBuilder.Host        = canonicalHostname;
             string text  = null;
             string text2 = null;
             string host  = uri.Host;
             int    num   = host.IndexOf('.');
             if (num >= 0)
             {
                 text2 = host.Substring(0, num);
                 text  = host.Substring(num + 1);
             }
             string text3 = null;
             if (!string.IsNullOrWhiteSpace(text) && !string.IsNullOrWhiteSpace(text2))
             {
                 text3 = "realm=" + text + "&vd=" + text2;
             }
             if (!string.IsNullOrEmpty(uriBuilder.Query))
             {
                 uriBuilder.Query = uriBuilder.Query.Substring(1) + "&" + text3;
             }
             else
             {
                 uriBuilder.Query = text3;
             }
         }
         redirectUri = uriBuilder.Uri;
         return(true);
     }
     if (VanityDomainRedirectModule.IsMissingTrailingSlashRequired(uri.LocalPath))
     {
         UriBuilder uriBuilder3 = new UriBuilder(uri);
         UriBuilder uriBuilder4 = uriBuilder3;
         uriBuilder4.Path += "/";
         redirectUri       = uriBuilder3.Uri;
         return(true);
     }
     return(false);
 }
示例#2
0
 internal static bool TryGetRedirectUri(Uri uri, out Uri redirectUri)
 {
     redirectUri = null;
     if (HttpRedirectCommon.UriIsHttps(uri))
     {
         return(false);
     }
     redirectUri = new UriBuilder(uri)
     {
         Scheme = "https",
         Port   = 443
     }.Uri;
     return(true);
 }
 internal static bool TryGetRedirectUri(Uri uri, string canonicalSecureHostName, out Uri redirectUri)
 {
     redirectUri = null;
     if (HttpRedirectCommon.UriIsHttps(uri))
     {
         return(false);
     }
     redirectUri = new UriBuilder(uri)
     {
         Host   = canonicalSecureHostName,
         Scheme = "https",
         Port   = 443
     }.Uri;
     return(true);
 }