后台-扩展-通行证设置,设置完后会生成api_key 和密钥
下载适用于3.6版 api开发工具包,并且在项目中引用
http://nt.discuz.net/showtopic-81187.html
修改WebSampleHelper.DiscuzSessionHelper.cs,引用DiscuzToolkit.dll
WebSampleHelper.DiscuzSessionHelper中
apikey=生成的apikey
secret=生成的密钥
url=设置的论坛地址,并且以/号结束
调用登录
DiscuzSession ds;//声明身份认证类
登录: ds.Login(ds.GetUserID(用户名),密码,false,100,"");
调用页面部分代码
DiscuzSession ds;
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies["dnt"] == null)
{
unlogin.Visible = true;
ds = DiscuzSessionHelper.GetSession();
}
else
{
login.Visible = true;
ds = DiscuzSessionHelper.GetSession();
try
{
ds.session_info = ds.GetSessionFromToken(Session["AuthToken"].ToString());
}
catch
{
Response.Redirect("SessionCreater.aspx?next=default");
}
userName = ds.GetUserInfo(ds.GetLoggedInUser().UId).UserName;
}
}
以上资料来源:奎宇工作室
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23109131/viewspace-714620/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/23109131/viewspace-714620/