Results 1 to 2 of 2

Thread: Redirect user to different pages

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Answers
    1

    Redirect user to different pages

    I am using Login control provided in the framework for my website. I want to redirect user to different pages based on roles ( using the ASP. Net Membership Provider). I tried doing that in the LoggedIn event however the user in the LoggedIn event does not get updated. It always shows empty string on first login. How to take care of that?


  2. #2
    Junior Member
    Join Date
    Sep 2007
    Answers
    15

    Re: Redirect user to different pages

    You can ovveride Login component Authentificate Event for yourself
    something like this ...
    protected void login_Authenticate(object sender, AuthenticateEventArgs e)
    {
    if (Membership.ValidateUser(login.UserName, login.Password))
    {
    e.Authenticated = true;
    if (Roles.IsUserInRole("some role 1"))
    login.DestinationPageUrl = "some url1";
    else if (Roles.IsUserInRole("some role 2"))
    login.DestinationPageUrl = "some url 2";

    }
    else
    e.Authenticated = false;
    }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact