Plase guide me how to get URL path excluding page name on localhost and server.
for example for the page Active.aspx local path that I want to get is here in bold.
*http://localhost:1532/WebFolder/*Active.aspx
and on server I want to get this bold part
*http://domain.com/WebFolder/*Active.aspx
Similarly if page is in root it will return
*http://domain.com/Active.aspx or *http://localhost:1532/**Active.aspx
Use the IP address 127.0. 0.1 for localhost addressing. For example, enter "http://127.0.0.1" into any web browser, and you will see a web page hosted by a web server on the same computer if one is running. Most computers and devices will also allow "http://localhost" for the same purpose.
It can be done in two steps: On the server, create a virtual host like forward.mydomain.com with a reverse proxy to some unused port (say, 5000 ). Now create a tunnel so whatever comes at port 5000 on the server is tunneled to your local machine's port 3000 (PC/laptop).
For example, a locally installed website may be accessed from a Web browser by the URL http://localhost to display its home page. The name localhost normally resolves to the IPv4 loopback address 127.0. 0.1, and to the IPv6 loopback address ::1.
A URL (Uniform Resource Locator) identifies a resource on a remote server and gives the network location on that server. The URL path is the string of information that comes after the top level domain name. You can use the HTTP-proxy to block websites that contain specified text in the URL path.
Request.ApplicationPath
- Gets the ASP.NET application's virtual application root path on the server.
Request.Path
- Gets the virtual path of the current request.
Edit
To get domain + current request + virtual path of the current application, try below:
Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath
Request.Url.AbsoluteUri is the way to go
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With