Asp. NET Integration discuz! NT3.5 instance description (including user login, comments, etc.)

Source: Internet
Author: User

http://bbs.51aspx.com/showtopic-30029.html#230540

A moment ago want to do a buy navigation site, see some buy navigation station has a forum, oneself also want to add one, studied the next discuz! NT, found API interface, suddenly thought of using discuz! NT to integrate the site, it is not very convenient, members that part of the need to develop their own.

Just do it, come down. API Examples and development package study a bit, looked again is still confused, do not know whether oneself is too stupid. And found that the API has errors, to the official forum for help seems to have not been answered, it seems to be only on their own AH. Read N times finally understand that the whole API is familiar with the use of the method, found that the API is convenient but a lot of problems, where the user login after jump behavior (stop jumping to jump, efficiency is too low, the impact of search engine included) there is "code:103, Message: The current session submitted by the CALL_ID is not greater than the previous call_id "error, but let me thoroughly to the API without words depressed, finally had to use the second set of methods to download the source of their own integration +discuz! NT API.

Okay, discuz!. NT is open source program, otherwise I really give up using, say My site Xuzhou 86516 buy navigation http:/www.86516tuan.com, you can see I mainly integrate the user's login status and access to login information (login and registration are completed in the forum), login and exit, the user's comments, Automatic post and system backstage planning tasks, and so on, the following describes in the integration method, need discuz! NT DLL, I am putting all the DLLs into the bin directory of my website, with the code attached.

1, the user's login status and access to login information

    1. Using Discuz.forum;
    2. Using Discuz.entity;
    3. String discuzname = String. Empty;
    4. if (request.cookies["dnt"]! = NULL)
    5. {
    6. Already logged in
    7. int uid = Convert.ToInt32 (request.cookies["dnt" ["userid"]);
    8. Get Login User Information
    9. UserInfo info = users.getuserinfo (UID);
    10. if (info! = null)
    11. {
    12. Discuzname = info. Username;
    13. }
    14. Else
    15. {
    16. Discuzsession ds = Discuzsessionhelper.getsession ();
    17. Ds. Logout (String. Empty);
    18. }
    19. }
    20. Else
    21. {
    22. Not logged in
    23. }
Copy Code

2, login and exit, need API Discuztoolkit development Package DLL, is: http://nt.discuz.net/showtopic-81187.html

    1. Using Discuz.toolkit;
    2. Discuzsession ds = Discuzsessionhelper.getsession ();
    3. Ds. Logout (String. Empty);
Copy Code

3, automatic posting, I collect a purchase data will give discuz! NT Forum sends a post, and both sides use the ID corresponding to the
For example: Http://www.86516tuan.com/goods/787.html and Http://www.86516tuan.com/bbs/showtopic-817.aspx
Automatically create the theme is also the API, the method is as follows, the specific parameters please refer to the Official API development Guide

    1. Discuzsession ds = Discuzsessionhelper.getsession ();
    2. Topiccreateresponse TCR = ds. Createtopic (UID, title, FID, message,tags,type_id);
Copy Code

4. Get user comments and use the official API

    1. Discuzsession ds = Discuzsessionhelper.getsession ();
    2. Topicgetrencentrepliesresponse TRR = ds. Getrecentreplies (FID, Tid, page_size, Page_index);
Copy Code

5, published a new comment, here is not the main reason for the initial adoption of the API, the API needs to jump to verify the user. After studying the source code, write their own comment function, the main call the official stored procedure "Dnt_createpost1", because of too many parameters, here do not write code, the main parameter assignment, user data can be based on the method to obtain user information to obtain, in addition to the official download data dictionary, To determine the parameter function.

Asp. NET Integration discuz! NT3.5 instance description (including user login, comments, etc.)

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.