I know ASP.NET does this automatically, but for some reason I can't seem to find the method.
Help anyone? Just as the title says.
If I do a Response.Redirect("~/Default.aspx"), it works, but I don't want to redirect the site. I just want the full URL.
Can anyone help me out?
For the "/#{path}/Default.aspx" part, use:
Page.ResolveUrl("~/Default.aspx")
If you need more:
Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port
In a web control, the method is ResolveUrl("~/Default.aspx")
Take a look at the VirtualPathUtility class.
There are at least three ways of doing this. I asked if there was any difference, but I didn't get any answer.
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