







Method marked with this attribute determines if authentication is required.
Namespace:
HttpServer.Controllers
Assembly:
HttpServer (in HttpServer.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
Remarks
The method should take one parameter (int level), return a bool and be protected/private.
You should throw UnauthorizedException if you are using HTTP authentication.
Examples
public enum UserLevel
{
Guest,
User,
Admin,
SuperAdmin
}
public class UserController : RequestController
{
[AuthRequired(UserLevel.User)]
public string View()
{
return "Can also be viewed by users";
}
[AuthValidatorAttribute]
public bool ValidateUser(int level)
{
(User)user = Session["user"];
return user != null && user.Status >= level;
}
}