How to obtain information about the URL that was last requested by the client

Source: Internet
Author: User
Tags get ip

How to obtain information from the URL that was last requested by the client in asp.net:

Urlreferrer: is a URI object

Button Events in default1.aspx:

Response.Redirect ("Default2.aspx", false);

In the Page_Load event of the Default2.aspx page:

string str = Request.UrlReferrer.AbsolutePath; Get the absolute path of the URI
string str1 = Request.UrlReferrer.Authority; Get IP Address
String str2 = Request.UrlReferrer.AbsoluteUri; Get an absolute URI


Uri Myurl = request.urlreferrer;
Response.Write ("Referrer URL Port:" + Server.HTMLEncode (MyUrl.Port.ToString ()) + "<br>"); Port
Response.Write ("Referrer URL Protocol:" + Server.HTMLEncode (myurl.scheme) + "<br>"); Agreement

Response.Write (str+ "-" +str1+ "-" +str2);

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.