What's good practice for ASP.Net MVC4 Login Sessions? -
currently, website stores session id next user's entry in database , ip address, stored in cookie. if session id , ip address match on each page grant them access. seems fine, want allow people login website on multiple ip addresses/multiple sessions.
so i'm wondering best , secure way be? store username , password in session, store username , hashed password in session or store unique id in new "sessions" table of database user's id next it? store session id in cookie?
i'm not sure if session tampering thing, assume it's possible elite i'm trying secure possible. know editing cookies simple too.
the website uses web service in background. when user enters login details, sent service , checked returns yay or nay. reason service used multiple applications of different platforms. basic/simple membership model won't work here.
i managed done following guides here: http://www.codeproject.com/articles/13032/custom-membershipprovider-and-roleprovider-impleme , here: http://logcorner.wordpress.com/2013/08/28/how-to-configure-custom-membership-provider-using-asp-net-mvc4-with-external-login-like-facebook-yahoo-google-or-other-relying-party-accounts-2/
i managed working our service overriding required methods customer membership , making them check our service , responding accordingly. works great.
example
public override bool validateuser(string username, string password) { myuser newuser = new myuser { email = username, password = password }; try { myuser user = myservice.authenticate(newuser); if (user.email != null && user.isactivated) { return true; } else { return false; } } catch (exception e) { return false; } } it gives ability use membershipcreatestatus registering new users. let me specify tiny details of why fail rather throw error did previously. pointing me in right direction mystere man.
Comments
Post a Comment