User problem

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
 
J

Juan T. Llibre

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
 
S

shapper

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top