. Net2.0 architecture second-level domain name access form

Source: Internet
Author: User

QuanCheng Shangcheng multi-user edition has the need to access the form of second-level domain names in terms of ACCESS format. Quancheng found through data study that most of the solutions provided in the network are based on the re-targeting URL address, it is equivalent to forwarding, and cannot implement real second-level domain name access; or rewrite the URL address to implement second-level domain name access, which indeed achieves real second-level domain name access, but there is a fatal defect, this greatly reduces the program running performance when the URL address is overwritten by a program. So far, can there be a third solution that is more effective in solving access to second-level domain names without affecting program performance. We have made the third original solution, so we can use it to develop it. We will discuss and practice with our technical friends !! Please try your best to improve a perfect second-level domain name ACCESS format for. Net !!!!

The code for implementing the second-level domain name Access Solution of Quancheng mall multi-user edition is as follows:

 

String STR = system. Web. httpcontext. Current. Request. url. Host. tostring ();

String aburl = system. Web. httpcontext. Current. Request. url. absoluteuri. tostring ();

String strr = system. Web. httpcontext. Current. Request. querystring. tostring ();

String strurl = system. Web. httpcontext. Current. Request. url. pathandquery. tostring ();

String [] strlist = Str. Split (New char [] {'.'});
String TB = strlist [0]. tostring ();

If (strlist. length> = 3)
{

If (Tb. tolower () = "www ")
{

If (strr. tolower (). Contains ("SJID "))
{
String [] strl = system. Text. regularexpressions. RegEx. Split (strr, "&", system. Text. regularexpressions. regexoptions. ignorecase );
Int SID = convert. toint32 (system. text. regularexpressions. regEx. split (strl [0], "=", system. text. regularexpressions. regexoptions. ignorecase) [1]);
If (New configdb (). getissdo () = "1 ")
{
If (Tb. tolower () = "192" | TB. tolower () = "127 ")
{
Response. Redirect ("http: //" + STR + "/userweb/" + Sy. getmb (SID) + strurl );
}
Else
{
Response. redirect ("http: //" + Str. replace ("www", Sy. getsjuserbyid (SID )). replace ("CP1", Sy. getsjuserbyid (SID) + strurl );
}
}
Else
{
If (Tb. tolower () = "192" | TB. tolower () = "127 ")
{
Response. Redirect ("http: //" + STR + "/userweb/" + Sy. getmb (SID) + strurl );
}
Else
{
Response. Redirect ("" + weburl + "/userweb/" + Sy. getmb (SID) + strurl );
}
}
}

}
Else
{
If (! Sy. supplymembernameexistt (strlist [0]. tostring ()))
{

System. Web. httpcontext. Current. response. Write (getym ("" + weburl + "/error. aspx "));
Response. End ();
Return;

}
Else
{

Sqldatareader SDR = Sy. getadmindetailsbyname (strlist [0]. tostring ());
String MB = string. empty;
String cid = string. empty;
While (SDR. Read ())
{
MB = SDR ["MB"]. tostring ();

Cid = SDR ["ID"]. tostring ();
}
SDR. Close ();
If (! Strurl. tolower (). Contains ("? "))
{
If (strurl. tolower (). Contains ("html "))
{
If (strurl. tolower (). Contains ("default "))
{
Response. Redirect (weburl );
Response. End ();
Return;
}
Else
{
System. Web. httpcontext. Current. response. Write (getym ("" + weburl + "/" + strurl + ""));
Response. End ();
Return;
}
}
Else
{

System. Web. httpcontext. Current. response. Write (getym ("" + weburl + "/userweb/" + MB + "/index. aspx? SJID = "+ CID + ""));
Response. End ();
Return;
}

}
Else
{

System. Web. httpcontext. Current. response. Write (getym ("" + weburl + "/userweb/" + MB + "/" + strurl + ""));
Response. End ();
Return;

}
}
}
}

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.