How multiuser systems bind International domain names

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

Multi-User system in the network is very common, such as Taobao or shopping online shop is the most typical multi-user system, each owner has a two-level domain name of the store (such as: http://shop88888888.xiegoo.com/), it seems that everyone is independent, But from the technical perspective, in fact, every shop is using the same set of procedures, the only difference is the shop interface and data.

believe that the realization of such a two-level domain name point to the function of different stores, for most programmers is not difficult, because the shop behind the 88888888 hidden store only ID, through the shop88888888 of the store's interface and data from the database to filter out is very simple, I don't explain it in detail here. But we often see on the internet many "multi-user mall" or "Build station system", support binding international domain names, such as the purchase of their own independent shop system http://www.shopxg.com/, as long as online registration, online binding international domain name, you can access their online shop. I have been involved in the development of SHOPXG, how to achieve such a function, take out to share with you, of course, may not be the best and most effective method, but hope to help those who are worried about the problem of technical friends.

Because SHOPXG is used. NET development, so the situation I mentioned below may not be suitable for other language systems, but the principle is interlinked, hoping to give you a little enlightenment.

The first step: the design of the database, in the "store shop" This table, to set a field, storage of international domain names;

The second step: in the SHOPXG site to do a pan-resolution, is to make any point to the SHOPXG site of the server's international domain name, will be bound to the SHOPXG, as to how to do a pan-resolution, you can go to Google check;

Step three: Take the index.aspx page of the front desk for example, when a customer enters www.yifull.com/ShopLogin.aspx and www.tiaopidan.com/ shoplogin.aspx, the shoplogin.aspx page will immediately get to the currently entered domain name, such as the use of request.servervariables["SERVER_NAME". ToString (); Of course shopxg is using urlrewrite rewrite technology to get the current domain name, there are many ways, you can choose for yourself;

The fourth step: using the current domain name, to the database to accurately match to a store, and then the store data to the foreground display;

Of course, the above steps are very easy to achieve, is not a problem, but the implementation of a multi-user system in each store to bind the international domain name, there are many small problems can not be overlooked:

1, each page frequently gets the current domain name, then to the database matching, just know which store in the request data, will cause system inefficiencies, so we want to let the customer first access to a domain name, the get back shop number into local cookies, when customers continue to visit or next visit , directly from the cookies can know the current domain name corresponding to which store;

2, the user landing problem: The general site is to use cookies to store whether I have landed information on a website, for multi-user systems, if the user landing, cookies did not build, it is easy to create a landing site, it is equivalent to landing on the multi-user system on all sites; If you can log on to someone else's web site backstage, the consequences will be disastrous; 8630.html "> Sometimes even cause my order to have someone else's order, which is caused by cookies. So when we build cookies, we have to distinguish between domains, In the process of judging the user landing, we should also strictly judge the input domain name and the domain of the cookies corresponding;

3, the customer binds the international domain name time, must judge the customer domain name already exists, and has pointed to the correct IP, otherwise once binds, the customer's website cannot visit;

Gets the IP that the domain name points to

public string getipbydomain (string url)

{

if (URL. Trim () = = string. Empty)

Return "";

Try

{

System.Net.IPHostEntry host = System.Net.Dns.GetHostByName (URL);

Return host. Addresslist.getvalue (0). ToString ();

}

catch (Exception e)

{

return "fail";

}

}

if (this. Getipbydomain (this.tbDomian.Text) = = "Fail")

{

Response.Write ("");

Return;

}

if (this. Getipbydomain (This.tbDomian.Text)!= "202.91.243.151")

{

Response.Write ("");

Return;

}

4, in the process of any query database operation, must provide shop ID to query, so as to avoid someone to initiate malicious operations, the other shop information query out.

Of course, in the implementation of multi-user system binding international domain name, will encounter many other problems, welcome to Exchange. My e-mail:cxl@xiegoo.com.

Related Article

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.