How can I pass FormsAuthentication.SetAuthCookie from Data Access Layer Class to WebService to Javas

Posted by Reaction21 on Stack Overflow See other posts from Stack Overflow or by Reaction21
Published on 2010-01-29T06:08:37Z Indexed on 2010/04/11 22:03 UTC
Read the original article Hit count: 483

I am using DotNetOpenAuth in my ASP.Net Website. I have modified it to work with Facebook Connect as well, using the same methods and database structures. Now I have come across a problem.

I have added a Facebook Connect button to a login page. From that HTML button, I have to somehow pull information from the Facebook Connect connection and pass it into a method to authenticate the user. The way I am currently doing this is by:

  1. Calling a Javascript Function on the onlogin function of the FBML/HTML Facebook Connect button.
  2. The javascript function calls a Web service to login, which it does correctly.
  3. The web service calls my data access layer to login.
  4. And here is the problem: FormsAuthentication.SetAuthCookie is set at the data access layer. The Cookie is beyond the scope of the user's page and therefore is not set in the browser.

This means that the user is authenticated, but the user's browser is never notified.

So, I need to figure out if this is a bad way of doing what I need or if there is a better way to accomplish what I need. I am just not sure and have been trying to find answers for hours. Any help you have would be great.

© Stack Overflow or respective owner

Related posts about webservice

Related posts about JavaScript