|
在此,我就將此次經(jīng)歷寫出來,希望對(duì)您有用。
在看過這篇文章
http://www.jb51.NET/article/20851.htm
和這篇文章
http://www.jb51.NET/article/20850.htm
按上述文章的描述,先按discuz!nt的用戶指南,在windows 2003下安裝好論壇。
并以admin進(jìn)去,添加apikey等。
然后用VS2008新建一項(xiàng)目,添加toolkit.dll和json的引用。
好了, 如果你認(rèn)真看過上述文章,再加上,我這兒貼的一點(diǎn)代碼,應(yīng)該可以完成了。
在項(xiàng)目中注冊(cè)新用戶時(shí),也同時(shí)調(diào)用論壇的用戶注冊(cè),這樣就同步注冊(cè)了。至于刪除用戶,似乎Discuz!NT沒有提供API,可以在項(xiàng)目中刪除用戶時(shí),再直接去刪除Discuz!NT的user表中的相關(guān)項(xiàng)。
代碼(實(shí)現(xiàn)了登錄和注冊(cè))如下:
復(fù)制代碼 代碼如下:
using System;
using System.Collections;
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 Discuz.Toolkit;
namespace IntDNT3
{
public partial class _Default : System.Web.UI.Page
{
string api_key = "c83a253f082bc671d8fbe42d485a1488";
string secret = "bdb7378cef77149adec776b1b6e92ee8";
string url = "http://localhost/";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnValidation_Click(object sender, EventArgs e)
{
DiscuzSession ds = new DiscuzSession(api_key, secret, url);
Uri uri = ds.CreateToken();
Response.Redirect(uri.ToString());
}
protected void btnLogin_Click(object sender, EventArgs e)
{
DiscuzSession ds = new DiscuzSession(api_key, secret, url);
int uid = ds.GetUserID(tbUserName.Text);
ds.Login(uid, tbPWD.Text, false, 10, "");
}
protected void btnRegister_Click(object sender, EventArgs e)
{
DiscuzSession ds = new DiscuzSession(api_key, secret, url);
ds.Register("testa", "123123", "dafafa@51ASPx.com", false);
}
}
}
AspNet技術(shù):asp.net與Discuz!NT整合集成實(shí)例教程,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。