AuthorizationAttribute.FormatErrorMessage Method

[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)

Syntax

'Declaration
Protected Function FormatErrorMessage ( _
    operation As String _
) As String
'Usage
Dim operation As String
Dim returnValue As String

returnValue = Me.FormatErrorMessage(operation)
protected string FormatErrorMessage(
    string operation
)
protected:
String^ FormatErrorMessage(
    String^ operation
)
member FormatErrorMessage : 
        operation:string -> string 
protected function FormatErrorMessage(
    operation : String
) : String

Parameters

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

Return Value

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

Remarks

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 nulla null reference (Nothing in Visual Basic), 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.

See Also

Reference

AuthorizationAttribute Class

System.ComponentModel.DataAnnotations Namespace