我是 Web 处理程序的新手。这是基本上取自教程 www.facebooksdk.net 的处理程序。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace PogoTrip
{
/// <summary>
/// Summary description for FacebookLogin1
/// </summary>
public class FacebookLogin : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
var accessToken = context.Request["accessToken"];
context.Session["AccessToken"] = accessToken;
context.Response.Redirect("~/Default.aspx");
}
public bool IsReusable
{
get { return false; }
}
}
}
然后这是我用来尝试检索令牌的代码:
protected void Page_Load(object sender, EventArgs e)
{
var accessToken = Session["AccessToken"].ToString();
var client = new Facebook.FacebookClient(accessToken);
dynamic me = client.Get("me", new { fields = "name,id" });
}
我不知道如何实际引用 .ashx 文件(我认为这就是问题所在
谢谢!