Facebook Connect and ASP.NET authentication - sync / cookie issue

Here is what I have :

  • ASP.NET 4.0 Web Application
  • Form Authentication (based on cookies)

Here 's what I'm trying to do :

  • Integration with Facebook Connect (using JavaScript and Graph APIs)
  • Providing a single sign-on service for my users (automatic user login if they are logged in and connected to Facebook)

Each page has a control that displays anonymous / registered user data.

Here's the problem: In Page_PreRenderthis user control (which is on every page, so keep in mind that this event is fired on every request of one page), I am trying to enable an automatic sign based on the Facebook authentication status (JavaScript API - Cookies).

If the sign is turned on successfully, I register them using FormsAuthentication.SetAuthCookie.

Everything is working fine.

, ( ), (, ) ( ..). , . "" , ( HttpContext.User.Identity.IsAuthenticated).

, "true ", cookie Forms Auth , HttpContext.User.Identity.IsAuthenticated - ?

, , , .

, , .

, . ( FormsAuthentication.SetAuthCookie), , HttpContext.User.Identity.IsAuthenticated ?

, / ?

Response.Redirect , cookie HTTP-?

, doco Facebook Connect , , .

... !

+3
1

, ( , , ).

, FormsAuthentication.SetAuthCookie cookie HTTP. HttpContext.User.Identity.IsAuthenticated HTTP ( cookie).

, Response.Redirect(this.Context.Request.RawUrl, true) ( ), cookie HTTP-.

, Login.aspx, cookie, -, "-" , cookie .

, , Facebook .aspx , auth.

, "" Microsoft Person .

+3

Source: https://habr.com/ru/post/1754714/


All Articles