http://blog.csdn.net/kingcruel/article/details/8230037

公司想做个论坛,后来改用Discuz论坛,想实现一个功能,公司网站为主网站,通过在主站登陆,同时在Discuz论坛也实现登陆;

下面写具体操作步骤:

第一、在服务器上部署Discuz论坛;

第二、配置discuz论坛信息:登录系统后台管理——》扩展——》通行证设置——》设置相关信息;

第三、配置完毕后,主要是为了获取API Key、密钥、url

第四、编写代码部分,主程序中添加DiscuzToolkit.dll、Newtonsoft.Json.dll文件;

            public string api_key = "fd95b978adb8123f11608d87dbe940fb";
            public string secret = "9914c078e44c4ae5b96a54ebc91d86f1";
            public string url = "http://localhost:8080/";//论坛地址事实上

//登录事件
protected void btnLogin_Click(object sender, EventArgs e)
{
    DiscuzSession ds = new DiscuzSession(api_key, secret, url);
    int uid = ds.GetUserID("tianjie");
    ds.Login(uid, "123456", false, 10, "");
    Response.Redirect(url);
}

//注册事件
protected void btnLogin_Click(object sender, EventArgs e)
{
    DiscuzSession ds = new DiscuzSession(api_key, secret, url);
    ds.Register("tianjie", "123456", "aaa@qq.com", false);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-07-12
  • 2022-01-19
猜你喜欢
  • 2021-10-15
  • 2021-11-20
  • 2021-09-15
  • 2021-07-25
相关资源
相似解决方案