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); }
public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, Exception innerException, params RedirectionLocation[] locations) : base(message, innerException) { if (type == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("type"); } if (message == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); } else if (message.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("message", SR.GetString(SR.ParameterCannotBeEmpty)); } if (type.InternalType == RedirectionType.InternalRedirectionType.UseIntermediary || type.InternalType == RedirectionType.InternalRedirectionType.Resource) { if (locations == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("locations", SR.GetString(SR.RedirectMustProvideLocation)); } else if (locations.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("locations", SR.GetString(SR.RedirectMustProvideLocation)); } } if (type.InternalType == RedirectionType.InternalRedirectionType.Cache && locations != null && locations.Length > 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.RedirectCacheNoLocationAllowed)); } if (locations == null) { //if we got here, then the redirect type doesn't care if there are locations... locations = EmptyArray<RedirectionLocation>.Instance; } this.Locations = new ReadOnlyCollection<RedirectionLocation>(locations); this.Type = type; this.Scope = scope; this.Duration = duration; }
public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, Exception innerException, params RedirectionLocation[] locations) : base(message, innerException) { if (type == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("type"); } if (message == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); } else if (message.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("message", SR.GetString(SR.ParameterCannotBeEmpty)); } if (type.InternalType == RedirectionType.InternalRedirectionType.UseIntermediary || type.InternalType == RedirectionType.InternalRedirectionType.Resource) { if (locations == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("locations", SR.GetString(SR.RedirectMustProvideLocation)); } else if (locations.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("locations", SR.GetString(SR.RedirectMustProvideLocation)); } } if (type.InternalType == RedirectionType.InternalRedirectionType.Cache && locations != null && locations.Length > 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.RedirectCacheNoLocationAllowed)); } if (locations == null) { //if we got here, then the redirect type doesn't care if there are locations... locations = EmptyArray <RedirectionLocation> .Instance; } this.Locations = new ReadOnlyCollection <RedirectionLocation>(locations); this.Type = type; this.Scope = scope; this.Duration = duration; }
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")); }
public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, Exception innerException, params RedirectionLocation[] locations) : base(message, innerException) { if (type == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("type"); } if (message == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); } if (message.Length == 0) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("message", System.ServiceModel.SR.GetString("ParameterCannotBeEmpty")); } if ((type.InternalType == RedirectionType.InternalRedirectionType.UseIntermediary) || (type.InternalType == RedirectionType.InternalRedirectionType.Resource)) { if (locations == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("locations", System.ServiceModel.SR.GetString("RedirectMustProvideLocation")); } if (locations.Length == 0) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("locations", System.ServiceModel.SR.GetString("RedirectMustProvideLocation")); } } if (((type.InternalType == RedirectionType.InternalRedirectionType.Cache) && (locations != null)) && (locations.Length > 0)) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("RedirectCacheNoLocationAllowed")); } if (locations == null) { locations = EmptyArray<RedirectionLocation>.Instance; } this.Locations = new ReadOnlyCollection<RedirectionLocation>(locations); this.Type = type; this.Scope = scope; this.Duration = duration; }
public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, Exception innerException, params RedirectionLocation[] locations) : base(message, innerException) { if (type == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("type"); } if (message == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); } if (message.Length == 0) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("message", System.ServiceModel.SR.GetString("ParameterCannotBeEmpty")); } if ((type.InternalType == RedirectionType.InternalRedirectionType.UseIntermediary) || (type.InternalType == RedirectionType.InternalRedirectionType.Resource)) { if (locations == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("locations", System.ServiceModel.SR.GetString("RedirectMustProvideLocation")); } if (locations.Length == 0) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("locations", System.ServiceModel.SR.GetString("RedirectMustProvideLocation")); } } if (((type.InternalType == RedirectionType.InternalRedirectionType.Cache) && (locations != null)) && (locations.Length > 0)) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("RedirectCacheNoLocationAllowed")); } if (locations == null) { locations = EmptyArray <RedirectionLocation> .Instance; } this.Locations = new ReadOnlyCollection <RedirectionLocation>(locations); this.Type = type; this.Scope = scope; this.Duration = duration; }
public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, params RedirectionLocation[] locations) : this(message, type, duration, scope, null, locations) { }
public RedirectionException(RedirectionType type, RedirectionDuration duration, RedirectionScope scope, Exception innerException, params RedirectionLocation[] locations) : this(GetDefaultMessage(type, locations), type, duration, scope, innerException, locations) { }
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"); }
public RedirectionException(string message, RedirectionType type, RedirectionDuration duration, RedirectionScope scope, params RedirectionLocation[] locations) : this(message, type, duration, scope, null, locations) { }
public RedirectionException(RedirectionType type, RedirectionDuration duration, RedirectionScope scope, Exception innerException, params RedirectionLocation[] locations) : this(GetDefaultMessage(type, locations), type, duration, scope, innerException, locations) { }
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; }
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) { }
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) { }