asp.net ve c# ile yazdığınız programlara gelen üyelerinizin formu doldurmadan kısaca login olup kayıt etmek isteyebilirsiniz. Bunların sonucunda bir facebook butonu yapıp facebook sayfasından bilgileri çekebilirsiniz. Kodları aşağı kısımda yayınlıyorum herhangi bir sorun yaşarsanız cevaplarım..
[php]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;
using ASPSnippets.FaceBookAPI;
namespace webSiteAcces
{
public partial class Default : System.Web.UI.Page
{
protected void FacebookLogin(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,email", Request.Url.AbsoluteUri.Split(‘?’)[0]);
}
protected void Page_Load(object sender, EventArgs e)
{
FaceBookConnect.API_Key = "*****"; //Api Kodum
FaceBookConnect.API_Secret = "*****"; //Api Secret Kodum
if (!IsPostBack)
{
if (Request.QueryString["error"] == "access_denied")
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(‘User has denied access.’)", true);
return;
}
string code = Request.QueryString["code"];
if (!string.IsNullOrEmpty(code))
{
string data = FaceBookConnect.Fetch(code, "me");
FaceBookUser User = new JavaScriptSerializer().Deserialize<FaceBookUser>(data);
User.PictureUrl = string.Format("https://graph.facebook.com/{0}/picture", User.Id);
txtName.Text = User.Name;
txtUserName.Text = User.UserName;
txtUserId.Text = User.Id;
txtEmail.Text = User.Email;
profilResmi.ImageUrl = User.PictureUrl;
}
}
}
}
}
[/php]
