private static string FormatLocations(RedirectionLocation[] locations)
 {
     string str = string.Empty;
     if ((locations == null) || (locations.Length <= 0))
     {
         return str;
     }
     StringBuilder builder = new StringBuilder();
     int num = 0;
     for (int i = 0; i < locations.Length; i++)
     {
         if (locations[i] != null)
         {
             num++;
             if (num > 1)
             {
                 builder.AppendLine();
             }
             builder.AppendFormat("    {0}", locations[i].Address.AbsoluteUri);
         }
     }
     return builder.ToString();
 }
 private static string GetDefaultMessage(RedirectionType type, RedirectionLocation[] locations)
 {
     string str = string.Empty;
     if (type == null)
     {
         return str;
     }
     if (type.InternalType == RedirectionType.InternalRedirectionType.Cache)
     {
         return System.ServiceModel.SR.GetString("RedirectCache");
     }
     if (type.InternalType == RedirectionType.InternalRedirectionType.Resource)
     {
         return System.ServiceModel.SR.GetString("RedirectResource", new object[] { FormatLocations(locations) });
     }
     if (type.InternalType == RedirectionType.InternalRedirectionType.UseIntermediary)
     {
         return System.ServiceModel.SR.GetString("RedirectUseIntermediary", new object[] { FormatLocations(locations) });
     }
     return System.ServiceModel.SR.GetString("RedirectGenericMessage");
 }
コード例 #3
0
        static string GetDefaultMessage(RedirectionType type, RedirectionLocation[] locations)
        {
            string message = string.Empty;

            if (type != null)
            {
                if (type.InternalType == RedirectionType.InternalRedirectionType.Cache)
                {
                    message = SR.GetString(SR.RedirectCache);
                }
                else if (type.InternalType == RedirectionType.InternalRedirectionType.Resource)
                {
                    message = SR.GetString(SR.RedirectResource, FormatLocations(locations));
                }
                else if (type.InternalType == RedirectionType.InternalRedirectionType.UseIntermediary)
                {
                    message = SR.GetString(SR.RedirectUseIntermediary, FormatLocations(locations));
                }
                else
                {
                    //this an unknown extension redirection type...
                    message = SR.GetString(SR.RedirectGenericMessage);
                }
            }

            return message;
        }
コード例 #4
0
        static string FormatLocations(RedirectionLocation[] locations)
        {
            string result = String.Empty;
            if (locations != null && locations.Length > 0)
            {
                StringBuilder builder = new StringBuilder();
                int nonNullCount = 0;
                for (int i = 0; i < locations.Length; i++)
                {
                    if (locations[i] != null)
                    {
                        nonNullCount++;
                        if (nonNullCount > 1)
                        {
                            builder.AppendLine();
                        }
                        builder.AppendFormat("    {0}", locations[i].Address.AbsoluteUri);
                    }
                }

                result = builder.ToString();
            }

            return result;
        }
 public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, RedirectionLocation[] locations)
 {
   Contract.Requires(!String.IsNullOrEmpty(message));
 }
 public RedirectionException(RedirectionType type, RedirectionDuration duration, RedirectionScope scope, RedirectionLocation[] locations)
 {
 }