On how to get the website domain name

Source: Internet
Author: User

      string "") + context. Request.applicationpath;

The output of this sentence can be obtained by the address such as: http://localhost:25138/such a domain name is composed of two parts, where "/" This is by

Context. Request.applicationpath; the output is meant to get the virtual application root path of an ASP. NET application on the server.
The way to get the full path is:
Request.url  // gets information about the URL of the current request. The // output is:http://localhostRequest.Url.AbsoluteUri is to get absolute path output and also http:  //Request.Url.PathAndQuery getSystem.Uri.AbsolutePath separated by a question mark (?) and The System.Uri.Query property. The output is:

In addition, there is a method that is performed on the specified string comparison, that is, the StartsWith method, which determines whether the beginning of this string matches the specified string when compared using the specified comparison option.

There is also a method to compare to the end: EndsWith, which determines whether the end of this instance matches the specified string.

These two methods can be compared after ignoring the case, the approximate syntax of the two methods is the same as follows:

Url.startswith ("http//", StringComparison.OrdinalIgnoreCase)

This is the beginning of the URL to determine whether there is an HTTP header, and is ignoring the case of the premise

On how to get the website domain name

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.