欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net與Discuz!NT整合集成實(shí)例教程

 更新時(shí)間:2009年11月11日 00:58:52   作者:  
由于項(xiàng)目需要一個(gè)論壇,本來有CS的,在.net下很出名的國(guó)外開源論壇。但為了適應(yīng)國(guó)內(nèi)的風(fēng)氣,最后選用在國(guó)內(nèi)如日中天的Discuz!NT。將Discuz與asp.net開發(fā)的網(wǎng)站整合,有很多人已經(jīng)完成了。
但在網(wǎng)上沒有找到較詳細(xì)的描述。方法倒是有很多種。
在此,我就將此次經(jīng)歷寫出來,希望對(duì)您有用。
在看過這篇文章
http://www.dbjr.com.cn/article/20851.htm
和這篇文章
http://www.dbjr.com.cn/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);
}
}
}

相關(guān)文章

最新評(píng)論