C# Determing HTML Link Given Website
<p>If I am at a given website, with a given full URL, how can I determine the absolute path of any href or src attribute.</p>

<p>So if I have:</p>

<pre><code>string WebsiteImAt = "http://www.w3schools.com/media/media_mimeref.asp?q=1&amp;s=2,2#a"
//Just some random website with a sub path and a filename

string text = DownloadHTML(WebsiteImAt);

string href = "/something/somethingelse/filename.asp";
//Should go to http://www.w3schools.com/something/somethingelse/filename.asp

string href2 = "something.asp";
//Should go to http://www.w3schools.com/media/something.asp

string href3 = "something";
//Should go to http://www.w3schools.com/media/something
</code></pre>

<p>I'm having trouble getting my regex to work with "/blah" and just "blah" without the slashes:</p>

<pre><code>String value = Regex.Replace(text, "&lt;(.*?)(src|href)=\"(?!http)(.*?)\"(.*?)&gt;", "&lt;$1$2=\"" + absoluteUrl + "$3\"$4&gt;", RegexOptions.IgnoreCase | RegexOptions.Multiline);

return value.Replace(WebsiteImAt + "/", WebsiteImAt);
</code></pre>

<p>I cannot alter each href/src to resolve to the correct address.  How do I fix my regex to account for the three href cases above?</p>
