The website and the Discuz forum carries on the integration, realizes the user synchronous registration, the single point landing, the synchronization deletes the user, synchronizes modifies the user password

Source: Internet
Author: User
Tags set cookie domain transfer

Recently the company's Web site to be with the Discuz forum for integration, to achieve user synchronization registration, single point of login, synchronous deletion of users, synchronization to modify user password

First introduction I encountered in the installation of some problems, Discuz forum is installed in the site subdirectory.
I am here to install under a stand-alone host, to create a virtual directory for the BBS, no new application pool, to build an application pool is another situation
1.dnt.config must be placed in the site root
2. The Discuz bin file is copied to the bin file in the root directory of the Web site
3. If the site root directory also exists web.config files, then the web.config of Discuz will be integrated into the site root directory web.config
inside, It cost me a lot of time.
Web.config Consolidation Method
adds
<add type= Discuz.Forum.HttpModule to the Similar:
        <add type=" Discuz.Forum.HttpModule, Discuz.forum "name=" HttpModule/>
put Discuz nt web.config node <system.webServer> copy to the root directory of your site Web.config inside to go to
OK, integration Web.config fix, it is so simple.
4.discuz 2.5config directory do not put in the site root directory, there will be errors, the internet is said to put in the root directory, do not know what the reason, I put in the root
directory will be wrong, may be 2.5 do not do it.
5. In addition to install under Windows Server 2003 also pay attention to permissions issues, permissions issues refer to official installation documentation
You can see the official installation documents, step-by-step according to the inside to do, generally do not appear any errors.
Official Document Download address: Official Document
Official discuz! NT FAQ The official discuz! NT FAQ
The installation has been finished, I hope to help you.

If there are still blank pages after the installation is complete, please refer to my "Install good discuz!". NT Forum After the first page is a blank. Solution "http://blog.csdn.net/SL0007/archive/2010/04/10/5469199.aspx


With DISCUZ!NT forum to achieve user synchronization registration, single point of landing
User Login Code:
public static void Login (string username, string password)
{
Try
{
Discuz.Config.GeneralConfigInfo Config = Discuz.Config.GeneralConfigs.GetConfig ();
int uid = Users.getuserid (username);
Forum user does not exist on registration
if (uid = = 1 | |!) Users.exists (UID))
{
Regedit (username, password);
UID = Users.getuserid (username);
}
Delete previous error logon information
Loginlogs.deleteloginlog (Dntrequest.getip ());
Refresh user total points according to integral formula
Usercredits.updateusercredits (UID);
Write cookie after user logs in
Forumutils.writeusercookie (UID, Utils.strtoint (dntrequest.getstring ("Expires"),-1), CONFIG. Passwordkey, Dntrequest.getint ("TemplateID", 0), Dntrequest.getint ("LoginMode",-1));
Update user last action, if no need to execute
Onlineusers.updateaction (Olid, UserAction.Login.ActionID, 0, config.) Onlinetimeout);
Update the last access time for this user
Users.updateuserlastvisit (UID, dntrequest.getip ());
}
Catch
{
}
}

code file Download: Integration.zip


http://nt.discuz.net/attachment.aspx?attachmentid=10782


This question here is important:
Which web.config file does my asp.net program actually read?
A. Under the IIS6 model, if the site MyWeb under the establishment of the BBS virtual directory, and for the BBS set up the application pool, then the BBS run under the ASP.net program will read the BBS directory web.config. If this BBS directory does not have web.config files, then the program will detect the site root directory myweb whether there are web.config files, if there is the use of its configuration, if there is no error.
B. If the BBS is not a virtual directory, or if it is a virtual directory but there is no application pool, then the program will read the Web.config file at the root of the Web site.
I just started. User integration is in the root directory of the site, the new virtual directory BBS, and not to the BBS directory to create a new application pool. So the BBS uses the website root directory web.config, this is because the subdirectory inherits the root directory web.config.
So, I will integrate the web.config of BBS into the root.
<add name= "Webbhttpmodule" type= "Webb.WAVE.Controls.Upload.WebbHttpModule, Webb.WAVE.Controls.Upload"/>
<add type= "Discuz.Forum.HttpModule, Discuz.forum" name= "HttpModule"/>
This can be integrated success, but the forum attachment upload function can not use Ah, because I added
<add type= "Discuz.Forum.HttpModule, Discuz.forum" name= "HttpModule"/>
It clashes with the Webbhttpmodule attachment upload feature of my original site's root directory.
Later tried the following method:
<location path= "BBS" allowoverride= "false" >
<system.web>
<remove name= "Webbhttpmodule"/>
<remove verb= "*" path= "progress.ashx"/>
</system.web>
</location>
But I can't, I don't know why not. Later to the BBS directory to create a new application pool BBS, so that the BBS to use their own web.config, the new application pool, BBS and the site is independent, do not need to put Dnt.config,web.config in the root directory.
But such BBS web.config still will inherit the website root directory web.config, as long as in BBS web.config inside revise <add type= "Discuz.Forum.HttpModule, Discuz.forum" name= "HttpModule"/>
<remove name= "Webbhttpmodule"/>
<remove verb= "*" path= "progress.ashx"/>
It's OK.

II: Registration
disucz! NT2.5 Forum Integration site, in this process, encountered a lot of problems. But in the effort, still one by one solution.
The following are some of the issues encountered in consolidation registration:
One: The initialization of the Member class
The official website provided isUserInfo __userinfo = new UserInfo ();
But my site also uses the UserInfo class, in order to be able to use the disucz! NT Forum, that's the way it must be written.
Discuz.Entity.UserInfo __userinfo = new Discuz.Entity.UserInfo ();
Two: Because the project also has the BasePage class, but cannot and disucz! NT integration together, in order to have a number of code must use the parameters, the disucz! NT copied to the site registration page
<summary>
User group information for the current user
</summary>
protected internal UserGroupInfo usergroupinfo;
<summary>
User group ID of the current user
</summary>
protected internal int usergroupid;
<summary>
Online table ID for current user
</summary>
protected internal int olid;
<summary>
Online User Information
</summary>
protected internal Onlineuserinfo oluserinfo;
<summary>
Current page name
</summary>
public string pagename = dntrequest.getpagename ();
It 's important to write down about configuration information here.
Configuration Note:
Forum in the website Directory BBS folder, where the forum can be installed.
Copy the DLL file, config folder, and cache folder under the Dnt.config,bin file in the forum directory to the root directory of the site.
Modify the configuration of the Dnt.config,
<?xml version= "1.0"?>
<baseconfiginfo xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd= "Http://www.w3.org/2001/XMLSchema" >
<dbconnectstring>data SOURCE=IP address; User Id=sa; password=***;initial catalog= database name; Pooling=true</dbconnectstring>
<Tableprefix>dnt_</Tableprefix>
<Forumpath>/bbs/</Forumpath>
<Dbtype>SqlServer</Dbtype>
<Founderuid>1</Founderuid>
</BaseConfigInfo>
Config folder, locate the General.config file in the<cookiedomain/> Modified to <cookiedomain/>.zyue.com</cookiedomain> is very important.
Register specific code Download disucz! NT 2.0 User Consolidated documentation


Recently do Discuz integration, encountered Discuz and my web site cookies can not cross-domain transmission problems.
Originally the cookie is a domain attribute, you can set the name, but I that B/s system is in the customer local use, not with domain name, only IP, make me very depressed.
Originally joined your website is Www.abc.com,bbs forum is bbs.abc.com, you just set cookie.domain=.abc.com can realize cross
Domain transfer. Cookie.domain cannot be an IP address. Depressed....
Later, a colleague raised the point, decided to discuz. NT under a new page, used to jump, as long as the user name, password transmission in the past can be. Over there
Do, you don't have to consider the problem of the cookie domain. Sure enough, there is experience and no experience of the difference, to learn more ah.
In Discuz. NT under the new page is also a skill, to follow his template engine to generate new pages, Discuz template engine is very good and powerful ah.
Finally in today to fix this problem ah, thank God Ah, people suddenly relaxed a lot, haha, you can write a blog ah.
The page passes the value several ways, session,cookie,viewstate, do not forget also may pass the value through the URL parameter, this is very important, may realize the cross
Station pass value, have time to study the difference of Session,cookie

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.