类型或名称空间名称"users"/"auth"在名称空间"Facebook"中不存在(您是否缺少程序集引用?) [英] The type or namespace name 'users'/'auth' does not exist in the namespace 'Facebook' (are you missing an assembly reference?)
本文介绍了类型或名称空间名称"users"/"auth"在名称空间"Facebook"中不存在(您是否缺少程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在编写以下代码后,出现错误
After writing this following code get an error
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Collections;
public partial class _Default : System.Web.UI.Page
{
public class API
{
private Facebook.auth.getSession sessionInfo;
public API()
{
sessionInfo = new Facebook.auth.getSession(); // Create the structure to store the session information
sessionInfo = Facebook.Login.LoginAndGetSession(); // We need somewhere to track the facebook session details
}
public DateTime SessionExpires { get { return sessionInfo.expires_DateTime; } }
public Facebook.users.getInfo GetUsersInfo(double userId)
{
var parameters = new SortedDictionary<string,>(); // Facebook parameter list (key value pair) that (needs to be sorted in order to get the MD5 hash correct - see Facebook.Security
parameters.Add("method", "facebook.users.getinfo");
parameters.Add("session_key", sessionInfo.session_key);
parameters.Add("uids", userId.ToString());
parameters.Add("fields", "first_name,last_name,pic_big,pic_small,profile_url,status,hs_info,hometown_location");
string jsonResult = JSON.Helper.StripSquareBrackets(Facebook.Web.SendCallToFacebook(parameters));
return (JSON.Helper.Deserialize<facebook.users.getinfo>(jsonResult));
}
public ArrayList GetListOfFriends()
{
var parameters = new SortedDictionary<string,>(); // Facebook parameter list (key value pair) that (needs to be sorted in order to get the MD5 hash correct - see Facebook.Security
parameters.Add("method", "facebook.friends.get");
parameters.Add("session_key", sessionInfo.session_key);
string jsonResult = Facebook.Web.SendCallToFacebook(parameters);
ArrayList listOfFriendsUserIds = JSON.Helper.ArrayFromJSON(jsonResult);
return listOfFriendsUserIds;
}
}
}
请帮我解决这个问题.在此先感谢
[edit]已添加代码块-OriginalGriff [/edit]
[edit2]<和>替换以删除虚假的结束标记-OriginalGriff [/edit2]
Please help me to solve this. Thanks in advance
[edit]Code block added - OriginalGriff[/edit]
[edit2]< and > replaced to remove spurious closing tag - OriginalGriff[/edit2]
推荐答案
您尚未包括Facebook.auth
的命名空间. 这需要作为标头的一部分包含.
如果尚未添加dll,则可能需要添加它作为参考.
You have not included the namespace forFacebook.auth
.
This needs to be included as part of the header.
You might need to add the dll as a reference if you have not already done so.
这篇关于类型或名称空间名称"users"/"auth"在名称空间"Facebook"中不存在(您是否缺少程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文