MVC Forms Authentication with custom database


MVC Forms Authentication with custom database



I'm trying to get forms authentication working for an mvc site. I have a custom database with a users table, and I would like to do my own password validation.

I am logging in my user like this:

if (PasswordHasher.Hash(password) == dataUser.Password) {    FormsAuthentication.SetAuthCookie(email, true);    return true; } 

The problem is, when the session expires obviously the user has to login again.

I am thinking I should be storing this Auth cookie in my users table?

Update: I'm obviously in desperate need of more education in this area. I just noticed that the user stays authenticated even after an iisreset.

I guess what I'm asking is how can I get persistent and non persistent authentication working properly. I want a user to not have to login again if they click "remember", and if they don't then their authentication should expire when the forms authentication is set to expire.


How to make data available when one Controller's View calls another Controller's View?

1:

Is WPF and MVC same concepts?
Turns out I forgot to put my variable in the second argument of the SetAuthCookie method. jQUERY onclick postIt was always sending true for the "persistent" argument. What is the best way to store WMD input/markdown in SQL server and display later?FML.. OutOfMemoryException C# When Uploading Image Files
Using HttpContext.Current.Application to store simple dataCant open Nerd Dinner 1.0 VS 2008 SP1 MVC 2

2:

After using Automapper to map a ViewModel how and what should I test?
I'd recommend implementing a custom Membership Provider so you must leverage the existing controls or patterns this are out there for the existing membership providers..


91 out of 100 based on 66 user ratings 881 reviews

@