Several methods to achieve unified login to third-party forums

Source: Internet
Author: User

Today, my blog friends asked me how to implement the unified login of third-party forums. Afterwards, I felt it was necessary to write and discuss the issue. If there are better solutions, I would like to share them for discussion.
Let me first talk about my method:

First: Modify the source code

There are many open-source forums on the Internet, such as Microsoft's ASP. NET forums and discuz! NT and Community Server are both excellent Asp.net open source forums. The project structure of these forums is very clear and modular. It is not difficult to implement unified user management for such forums. You only need to reconstruct the entire user module on the premise of ensuring the user interface. The advantage of this method is that it is seamlessly integrated with websites to facilitate management once and for all. The disadvantage is that you need to understand the code of these open-source forums. It is obviously difficult for some technically weak people. The other disadvantage is that you must be open-source. Otherwise, you will be powerless.

Method 2: Jump Logon

Compared with the first method, this method is much easier to implement and basically does not need to read code. First, create a login page in the Forum to get the user name and password in the get method, then call the login method of the Forum in the page_onload method to verify the login, after successful, call request. servervariables ("http_referer") obtains the source address and returns
. Next, you need to jump to your custom login page after the successful login of the website, such as response. Redirect ("http://bbs.aa.com/CLogin.aspx? Username = aaa & Password = 12345. Note that you must set the cookie validity period a little longer after logging on to the custom login page handler. Otherwise, the cookie will expire after you leave the page. You can perform corresponding processing based on various login results on the custom page. For example, if the login returns that the user does not exist, you can create a user forum to ensure that the website is used. When changing the password, you also need an interface to change the password of the Forum. The password change page of the Forum directs directly to the website. Otherwise, there will be problems. In short, you need a series of interfaces to achieve unified operations for websites and Forum users. This method is a bit simple and does not need to read the code. The disadvantage is that two sets of users are maintained.

Method 3: Automatic Login

I believe many of my friends have made automatic logons. In fact, the principle is the same. After a user successfully logs on to the main site, the user sends formatted data packets to the login interface of the Forum through post and then writes the returned cookies to the local device. The same is true for registration and password modification. Advantage: you can log on to a non-open-source forum without reading any code. disadvantage: you cannot use cross-origin because once a cross-origin website has no permission to write cookies for the Forum.

 

Conclusion: To achieve unified login, you should make decisions based on the Forum you choose. If you want to solve the problem thoroughly, find an open-source forum to modify the user module. If it doesn't matter, you can use either the second method or the third method.

 

If anyone has a better way, do not share it! Haha ~

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.