custom authenticate users, how?

J

Jeff

hi

asp.net 3.5

I'm wondering how to implement a custom authenication process.

When the user loggs in I have to check if that user exists in another
datasystem, if he exists then update the database with information about
that user and authenticate the user....

I thought Membership.ValidateUser did the trick but it only validates the
username and passwords...
what method do I need to invoke for it to authenticate the user?

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
}
 
S

sloan

First you say:
//but it only validates the
username and passwords...//

Then you say
//authenticate the user//
or
//I mean login the user//

And you say the first thing ("but it only validiates....") is *not* either
of the second items listed.


Huh?


I would read the 4 guys article(s)..........then post some better questions.




Here is your simplest (and not really useful) authentication:


protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{

bool isAuthenticated = true; // do your checks here // as is, this code
is not very useful

e.Authenticated = isAuthenticated ;

Console.WriteLine(e.Authenticated.ToString());


}
 
S

sqlman

hi

asp.net 3.5

I'm wondering how to implement a custom authenication process.

When the user loggs in I have to check if that user exists in another
datasystem, if he exists then update the database with information about
that user and authenticate the user....

I thought Membership.ValidateUser did the trick but it only validates the
username and passwords...
what method do I need to invoke for it to authenticate the user?

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
}

In a web service, one good approach is to employ SOAP headers and your
own custom authentication module:
http://msdn.microsoft.com/en-us/library/9z52by6a(VS.80).aspx

This way you can build your own authentication layer that can depend
on any kind of user profile storage (database, flat file, you name
it...)

When it comes to web pages, you can do Forms authentication or
similar. More info here:
http://msdn.microsoft.com/en-us/library/aa302415.aspx

In both cases you can implement your own Identity and IPrincipal and
make your roles work the way you want.
 

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

Top