Security and Authentication

Application-Wide Page Security

Description
This example shows how to enforce application-wide sign-in security without configuring sign-in on a page by page basis as is typical with role-based security.
Variables
Applies to
BasePage class
Code
 
/// 
/// Authorize method sets the access requirement of a page.
/// 
public override void Authorize(string roles) 
{ 
    if ((roles == null) || (roles == "")) 
    { 
        // If no login requirement specified on the page, default it to require login
        base.Authorize(BaseClasses.Utils.SystemUtils.ROLE_NOT_ANONYMOUS); 
    } 
    else 
    { 
        // Else, use the login requirement specified on the page.
        base.Authorize(roles); 
    } 
}

     

Terms of Service Privacy Statement