Asp.net Memebership Authorization without password
Asked Answered
P

1

7

To authanticate users in Asp.net Membership we can call method

FormsAuthentication.Authenticate(username, password)

how can I do the same job (generate session, cookies and all other staff that Authanticate does) without users password?

I'm trying to login user over facebook connect. User's facebook id is stored within the users data. User should be signed in like a normal user.

Publisher answered 9/12, 2009 at 1:6 Comment(0)
S
11

I think you can use the SetAuthCookie method.

more info here http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.setauthcookie.aspx

Stoller answered 9/12, 2009 at 1:10 Comment(4)
ASP.NET MVC 4 Simple Membership WebSecurity Source - see "Login" method: aspnetwebstack.codeplex.com/SourceControl/changeset/view/…Gymnasiast
that does not work when i ask WebSecurity.CurrentUserName it gives me the previous user.!!Zoie
@AmirMagdy do you find a better solution? Does it still cause the same problem?Subvene
@Subvene yep just do a redirect right after so the cookie is refreshed for the page and it'll workZoie

© 2022 - 2024 — McMap. All rights reserved.