سؤال

I have an MVC app that has a link that calls an action method of another MVC app that should automatically login the user. I have all the user information via:

var user = Membership.GetUser(userName);

But from here, I have no idea how to auto login the user.

The two websites are on different domains and my password is hashed.

هل كانت مفيدة؟

المحلول

If I understand your question correctly, you just call SetAuthCookie to let the user login to the site, since you already know the username.

FormsAuthentication.SetAuthCookie(userName, false);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top