Several different methods for obtaining url addresses

Source: Internet
Author: User

You can access your website using the following methods.

  I. C # code 1

String url = Request ["referer"];
Response. Write ("alert ('" url "')");
Response. End ();

Or directly use

Top. location. href

You can also use one of the following four methods:

HttpRequest. UrlReferrer
Request. UrlReferrer. AbsolutePath
HttpContext. Current. Request. Url. ToString ()
Request. ServerVariables ["Http_Referer"] can get the link address of the previous page

  Ii. HTML code

<Script>
Var url = 'js. aspx? Referer = 'encodeuricomponent (document. referrer );
Document. write ('<''script type = "text/java script" src = "'url'"> <''/script> ');
</Script>

  Iii. xmlhttp code

Var objXMLHTTP = new ActiveXObject ("MICROSOFT. XMLHTTP ");
Var url = "http://www.dzwebs.net/" "se. asp? Temp = "name1.value" & id = "name2.value" & len = "name3.value;

ObjXMLHTTP. open ("GET", url, false );
ObjXMLHTTP. send ();
Var strReturn = objXMLHTTP. ResponseText;
If (strReturn = "error ")
{Alert ("there is error occurred! ");

}

Original article: http://www.amhl.net/wenzhang/DianNao-BianChengKaiFa/20110419/175529.html

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.