Get absolute Url in asp.net

asp.net

Solution

Try Page.ResolveUrl.

string url = Page.ResolveUrl("~/Login.aspx");

If you need a complete URL, say to email it or something, take a look at this blog post.

Problem

When I'm running my website with visual studio, its root url is: `http://localhost:4657` I have strings containing paths like `~/Login.aspx` and I need to concatenate them so that the return will be `http://localhost:4657/Login.aspx`. I can see a lot of ways to do this, but what is the right way?

Original source