How to use membership provider with login control

Discussion in 'ASP .Net' started by ad, Jan 26, 2006.

  1. ad

    ad Guest

    I have created a custom Membership Provider, and set it as default
    membership provider in web.config.

    I have also set deny users ="?" in web.config.

    When I use a login control with it, it work fine. but now I want to valid
    with code like:

    MyMembershipProvider myProvider = new MyMembershipProvider();
    if (myProvider.ValidateUser("myid", "mypw"))
    {
    Response.Redirect("~/Home.aspx");
    }

    The ValidateUser return true, but it can't redierct to home.aspx.

    I find the page.user.identity.name is none after ValidateUser, but if I use
    login controls, the Page.User.Identity will set to the login id after valid.

    How can I use Membership Provider without login control?
     
    ad, Jan 26, 2006
    #1
    1. Advertisements

  2. ad

    Guest Guest

    ad,
    If you want to do everything programmatically, then you need to use this in
    conjunction with the FormsAuthentication class and methods. once you validate
    a user ("true") you need to create a new FormsAuthentication ticket and so on.
    Suggest you do some reading up in the documentation.

    Peter
     
    Guest, Jan 26, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.