How to create a fully qualified hyperlink to a resource dynamically?
Posted
by Slauma
on Stack Overflow
See other posts from Stack Overflow
or by Slauma
Published on 2010-06-12T10:59:02Z
Indexed on
2010/06/12
11:02 UTC
Read the original article
Hit count: 215
In ASP.NET I'd like to create a link which points to a specific Uri and send this link in an email to a user, for instance something like http://www.BlaBla.com/CustomerPortal/Order/9876
. I can create the second part of the Uri /CustomerPortal/Order/9876
dynamically in code-behind. My question is: How can I create the base Uri http://www.BlaBla.com
without hardcoding it in my application? Basically I want to have something like:
http://localhost:1234/CustomerPortal/Order/9876 (on my development machine)
http://testserver/CustomerPortal/Order/9876 (on an internal test server)
http://www.BlaBla.com/CustomerPortal/Order/9876 (on the production server)
So is there a way to ask the server where the application is running: "Please tell me the base Uri of the application" ? Or any other way?
Thank you in advance!
© Stack Overflow or respective owner