What is the simplest way to generate domain specific url from application path..?

Posted by harsh on Stack Overflow See other posts from Stack Overflow or by harsh
Published on 2013-06-29T09:17:45Z Indexed on 2013/06/29 10:21 UTC
Read the original article Hit count: 238

Filed under:
|

I have application specific url like below

~/Default.aspx
~/Manage/Page.aspx
~/Manage/Account/Default.aspx

I really don't know what are these kind of paths actually called.

Now I need them to convert to domain specific complete URL. No ../ or ../../ like thing in the URL. I want URLs like

http://www.example.com/Default.aspx
http://www.example.com/Manage/Page.aspx
http://www.example.com/Manage/Account/Default.aspx

Currently I am doing this following way (assuming I have HttpRequest object)

Request.Url.Host + path.Substring(1);

Is there a more simplest way to achieve this..?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET