MembershipService, and 'Remember Me'

C

Craig Lister

Hi guys,

I am dabbling with a small MVC project for learning, and have un into an issue. I am using the MembershipService for logging in, and it's logging me in nicely. My 'Rememberme' works as well as my Request.IsAuthenticated is picking up that I have logged in before.

However, when I initially log in, it does the Validation on my Username/Password. If that succeeds, I then make a call to get some basic user detils via a method GetUserDetails. That then puts a couple of fields into SessionState, so that my MasterPage can say, 'Welcome <FirstName>'.

However, if I close the browser and reopen, it just says 'Welcome '. So, the user is Authenticated, but I haven't called my GetUserDetails method... because at the moment, I only call it when I click 'Login'. Is there somewhere I can check and call this when the browser is closed and reopened?
 
A

Arne Vajhøj

I am dabbling with a small MVC project for learning, and have un into
an issue. I am using the MembershipService for logging in, and it's
logging me in nicely. My 'Rememberme' works as well as my
Request.IsAuthenticated is picking up that I have logged in before.

However, when I initially log in, it does the Validation on my
Username/Password. If that succeeds, I then make a call to get some
basic user detils via a method GetUserDetails. That then puts a
couple of fields into SessionState, so that my MasterPage can say,
'Welcome<FirstName>'.

However, if I close the browser and reopen, it just says 'Welcome '.
So, the user is Authenticated, but I haven't called my GetUserDetails
method... because at the moment, I only call it when I click 'Login'.
Is there somewhere I can check and call this when the browser is
closed and reopened?

You need to get some logic like:

if authenticated and not details in session then
load details into session
end if

executed before trying to display the details.

The remaining question is just exactly where to put
that logic.

Arne
 

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