User problem

Discussion in 'ASP .Net' started by shapper, Dec 11, 2006.

  1. shapper

    shapper Guest

    Hello,

    I am creating a user as follows:

    Membership.CreateUser("user", "pass", "")

    I checked the SQL tables and the user is there.

    Then I tried to authenticate the user as follows:

    Response.Write(FormsAuthentication.Authenticate("user",
    "pass").ToString)

    It allways gives me false.

    What am I doing wrong?

    Thanks,

    Miguel
    shapper, Dec 11, 2006
    #1
    1. Advertising

  2. re:
    > What am I doing wrong?


    The FormsAuthentication.Authenticate Method is not the proper tool to use.

    The Authenticate method verifies user credentials that are stored in the
    credentials section of the application configuration file, not in the Membership database.

    If you have created a login form, you can prompt the user for a user name
    and password and then call the ValidateUser method to perform the validation.

    There's sample code at :
    http://msdn2.microsoft.com/en-us/library/system.web.security.membership.validateuser.aspx





    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ===================================
    "shapper" <> wrote in message
    news:...
    > Hello,
    >
    > I am creating a user as follows:
    >
    > Membership.CreateUser("user", "pass", "")
    >
    > I checked the SQL tables and the user is there.
    >
    > Then I tried to authenticate the user as follows:
    >
    > Response.Write(FormsAuthentication.Authenticate("user",
    > "pass").ToString)
    >
    > It allways gives me false.
    >
    > What am I doing wrong?
    >
    > Thanks,
    >
    > Miguel
    >
    Juan T. Llibre, Dec 11, 2006
    #2
    1. Advertising

  3. shapper

    shapper Guest

    Hi,

    I tried this:
    Response.Write(Membership.ValidateUser("shapper", "27lamps11"))
    Response.Write(Me.User.Identity.IsAuthenticated)

    Now I get True and False.

    So how can I test if a user has login?

    Thanks,
    Miguel

    Juan T. Llibre wrote:
    > re:
    > > What am I doing wrong?

    >
    > The FormsAuthentication.Authenticate Method is not the proper tool to use.
    >
    > The Authenticate method verifies user credentials that are stored in the
    > credentials section of the application configuration file, not in the Membership database.
    >
    > If you have created a login form, you can prompt the user for a user name
    > and password and then call the ValidateUser method to perform the validation.
    >
    > There's sample code at :
    > http://msdn2.microsoft.com/en-us/library/system.web.security.membership.validateuser.aspx
    >
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ===================================
    > "shapper" <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I am creating a user as follows:
    > >
    > > Membership.CreateUser("user", "pass", "")
    > >
    > > I checked the SQL tables and the user is there.
    > >
    > > Then I tried to authenticate the user as follows:
    > >
    > > Response.Write(FormsAuthentication.Authenticate("user",
    > > "pass").ToString)
    > >
    > > It allways gives me false.
    > >
    > > What am I doing wrong?
    > >
    > > Thanks,
    > >
    > > Miguel
    > >
    shapper, Dec 11, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Rowton
    Replies:
    2
    Views:
    639
    Tom Rowton
    Aug 1, 2003
  2. Jaydeep
    Replies:
    3
    Views:
    1,033
    vedcyrus
    Jun 30, 2006
  3. =?Utf-8?B?YWJqb3Jr?=
    Replies:
    1
    Views:
    3,787
    Jeffrey Palermo
    May 5, 2004
  4. Somyos Jinkow

    user.isinrole in user control

    Somyos Jinkow, Jun 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,876
    =?Utf-8?B?cmFuZ2FuaA==?=
    Jun 1, 2004
  5. Stefan
    Replies:
    12
    Views:
    303
    Stefan
    Jan 10, 2006
Loading...

Share This Page