LoggerExtensionsLogUnauthorizedAccessAttempt Method

Log message for an exception where a user somehow managed to access a resource they shouldn't have access to. This is grounds for a security audit and immediate bug fix.

Definition

Namespace: MobileTrack.Web.Components.Extensions
Assembly: MobileTrack.Web.Components (in MobileTrack.Web.Components.dll) Version: 0.7+45c8d9adb5970d727cceec44a5ed61aea0016e50
[LoggerMessageAttribute(1005, LogLevel.Critical, "User {AccountId} attempted to perform an illegal action on {When} from {IpAddress}")]
public static void LogUnauthorizedAccessAttempt(
	this ILogger logger,
	UnauthorizedAccessException accessException,
	Guid accountId,
	DateTimeOffset when,
	string ipAddress
)

Parameters

logger  ILogger
Logger instance
accessException  UnauthorizedAccessException
Thrown exception
accountId  Guid
Account ID of the user
when  DateTimeOffset
When the incident took place
ipAddress  String
Address the user send the request from.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ILogger. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also