There are two ways to get a URL, either through the background or through the front JS, as follows:
1. Get the URL of the current page through C #
string url = Request.Url.AbsoluteUri; Result: http://www.jb51.net/web/index.aspx
String host = Request.Url.Host; Result: www.jb51.net
string rawurl = Request.rawurl; Result:/web/index.aspx
string localpath = Request.Url.LocalPath; Result:/web/index.aspx
2. Get the URL of the current page through JavaScript
var url = document. URL; Result: http://www.jb51.net/web/index.aspx
var href = document.location.href; Result: http://www.jb51.net/web/index.aspx
var host = Location.hostname; Result: www.jb51.net
The above is a small series for everyone to get the current page in the asp.net of the URL method (recommended) All the content, I hope to help you, a lot of support cloud Habitat Community ~