views:

69

answers:

0

Im using the Facebook SDK (http://facebooktoolkit.codeplex.com) to include Facebook-Connect into my Asp.net MVC Project. After someone logs into my Webapplication via Facebook Connect (I implemented that Facebook-Login-Button successfully) I want to fetch some data from the User. Therefore I created an ActionFilter that just checks if the User is logged in:

    public class FacebookConnectAttribute : ActionFilterAttribute
{
    public override void OnResultExecuting(ResultExecutingContext filterContext)
    {
       //var connectSession = new ConnectSession("APIKey", "Secret");
        var connectSession = new ConnectSession(ConfigurationManager.AppSettings["ApiKey"], ConfigurationManager.AppSettings["Secret"]);
        if (connectSession.IsConnected())
        {
            filterContext.Controller.ViewData["FBConnected"] = true;
            var api = new Api(connectSession);
            filterContext.Controller.ViewData["FBUser"] = api.Users.GetInfo();
        }
        else
        {
            filterContext.Controller.ViewData["FBConnected"] = false;
        }
    }
}

I seen this Code before, and it should work. The problem is, that connectSession.IsConnected() always return false and connectSession just has null and false values. The issue seems to be, that the Cookie is no set properly when I test it locally on my localhost (see google results).

I googled this and found solutions that are supposed to solve my problem:

But the problem is that I dont quite understand what they are trying to tell me. Im supposed to somehow:

  1. Add "127.0.0.1 localhost.local" to my host file
  2. Updated my FB application Connect settings to use "http://localhost.local/" URL and "localhost.local" domain.
  3. Create an IIS Web site on port 80 with the name "localhost.local".
    • I had to stop my default web site, which is also on port 80
  4. Update my Visual Studio 2010 web application to use IIS with the "http://localhost.local/" url.

What exactly do they mean, when they say "create an IIS Website on Port 80" or "Add 127.0.0.1 localhost.local to my host file". Im using Visual Web Developer Express, and pretty new to this whole Server-Configuration-Think.

I would very appreciate if someone could explain me step-by-step what Im supposed to to.