AuthorizationAttribute.FormatErrorMessage Method

WCF RIA Services

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Gets the formatted error message for the current AuthorizationAttribute to present to the user.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ServiceModel.DomainServices.Server (in System.ServiceModel.DomainServices.Server.dll)

protected string FormatErrorMessage(
	string operation


Type: System.String
Name of the operation that was denied.

Return Value

Type: System.String
The error message to present to the user.

Classes derived from AuthorizationAttribute should use this helper method to retrieve the user-visible message for ErrorMessage because it encapsulates the logic to evaluate ResourceType and ErrorMessage.

If ErrorMessage and ResourceType are both non-null, this method uses reflection to access that respective property in the respective resource type to obtain the message. If ResourceType is null, this method returns the literal value from ErrorMessage. If the literal value from ErrorMessage is blank, this method returns a default localized message.

The specified operation will be included in the generated message if format specifiers are present in the computed message.