How To Generate a Fully Qualified URL in ASP.NET from Scott Mitchell
Used this today, I was using an app config var in web.config to hold the fully qualified base URL for the application, but this blog by Scott Mitchell is a much cleaner and easier to maintain solution!
TIP: How To Generate a Fully Qualified URL in ASP.NET (E.g., http://www.yourserver.com/folder/file.aspx)
Imagine that you’ve got an ASP.NET page that is generating an email message that needs to include links back to the website. Perhaps you’re writing the next greatest online message board application and when someone replies to a thread you want to send out emails to the other thread participants indicating that a new message has been posted along with a link to view the just-posted message. You know that the URL to view a particular thread is, say, ~/Threads/View.aspx?ThreadId=threadId. But how do you turn that relative URL into an absolute URL like http://www.yourserver.com/Threads/View.aspx?ThreadId=threadId?
via Scott on Writing.