ASP.NET WebMethods – Request Information

When handling a Web Service it’s easy to focus on the parameters passed in to the web method, but there is a lot of additional information that comes along with the overall web platform.  You can access the various Uri information at System.Web.HttpContext.Current.Request.Url.

User Information including the Host Address and Name

UserHostAddress: “”
UserHostName: “”

The URL Infomation

  •     AbsoluteUri: “” – The full path of the URL.
  •     OriginalString: “” – The Uri as entered on the client.

 Server Host Information

  • Host: “”
  • DnsSafeHost: “”
  • Port: 80
  • Scheme: “http”

Note: DnsSafeHost is the one that can be used to do a call that is processed by DNS, it is sanitized to eliminate extended characters that don’t work with DNS.  Host is the original value which can included these characters.  Also see SO: Host vs DnsSafeHost.

The referring page.

  • UrlReferrer: {}

Leave a Reply

Your email address will not be published. Required fields are marked *