[英]How can I get Facebook userName by userID using Asp.net?
I am doing an App for android 我正在为Android做一个App
now I can using "Facebook SDK for Android" to get userID and store in SQL server 现在我可以使用“ Android版Facebook SDK”获取用户ID并将其存储在SQL Server中
The problem is .. 问题是 ..
how can I use "Asp.net 4.0" (visual web developer 2010) and "Facebook SDK for .NET" to parse these ID to userName on Server without login button?
如何使用“ Asp.net 4.0”(可视化Web开发人员2010)和“ Facebook SDK for .NET”将这些ID解析为服务器上的userName,而无需登录按钮?
I have found some information for using dynamic access token. 我发现了一些有关使用动态访问令牌的信息。
but all I have found examples are using visual 2013 , MVC , login button 但我发现的所有示例都使用visual 2013,MVC,登录按钮
that is not what i want. 那不是我想要的。 I just want a basic aspx.
我只想要一个基本的aspx。
Do anybody know anything about the question ? 有人知道这个问题吗?
http://i.stack.imgur.com/bBRlj.jpg http://i.stack.imgur.com/bBRlj.jpg
Facebook doesn't provide username. Facebook不提供用户名。 If you are looking for name of user then use this code
如果您要查找用户名,请使用此代码
Get accesstoken from here. 从这里获取accesstoken。 Step 1 : http://narendrajarad.blogspot.in/2014/07/facebook-login-using-javascript.html
步骤1: http : //narendrajarad.blogspot.in/2014/07/facebook-login-using-javascript.html
Step 2 : Add Facebook reference to your project from nuget packages. 第2步:从nuget包中将Facebook参考添加到您的项目。
Use this name space : 使用此名称空间:
using Facebook;
Use this code : 使用此代码:
_apiKey = "API KEY"
_apiSecret = "SECRET KEY"
var accessToken = "Pass accesstoken stored id hidden field" // check in above link
var client = new FacebookClient(accessToken);
dynamic me = client.Get("me");
Response.Write(me.first_name + "" + me.last_name);
If you are looking for more functionality in facebook using c# let me know. 如果您正在使用C#在Facebook中寻找更多功能,请告诉我。 I can surely help you.
我一定能为您服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.