Login and Logout Redirection

2019-09-15 00:20发布

问题:

I have a simple Web Forms login. The application has three roles, Admin, Expert and Member. I want to re-direct to a different sub-page for each. I also want to be able to re-direct to home page on logout.

I've asked a similar question here, but the solution overrode the LoginStatus LogoutPageUrl attribute. Can anyone suggest how to do this?

UPDATE 12/28/2012

So far, the only solution to this I have found is to create a new menu page containing security-trimmed links to the different destination pages. Leaving this question open for a while to elicit feedback / alternative solutions...

回答1:

So far, the only solution to this I have found is to create a new menu landing (destination) page containing security-trimmed links to the different destination pages.

protected void Page_Load(object sender, EventArgs e)
{
    if(User.IsInRole("Admin"))
        adminLink.Visible = true;

    if ((User.IsInRole("Member")) || (User.IsInRole("Admin")))
        questionsLink.Visible = true;
}