User problem

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I am creating a user as follows:

Membership.CreateUser("user", "pass", "(e-mail address removed)")

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
 
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/
===================================
 
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
 
Back
Top