title: What using directive can I implement in my .cs file that will let me use the "WebPageExecutingBase.Href()" Method?
body: <p>I have a <code>.cs</code> file that generates HTML. Within it, I would like to make this code a little more fool proof by using the <code>WebPageExecutingBase.Href()</code> method, which I have done in many cshtml files before (mainly with the use of the tilde <code>~</code>).</p>
  
  <p>However, the links are broken on the generated HTML if I include just the tilde:</p>
  
  <pre><code>string html = "&lt;a href=\"~/SomeFolder/SomeFile.cshtml\"&gt;Link&lt;/a&gt;"; //Generates a broken link.
  </code></pre>
  
  <p>But I can't seem to import the appropriate using directive for use with the <code>Href()</code> method in the environment of a <code>.cs</code> file alone.</p>
  
  <p>I have tried:</p>
  
  <pre><code>using System.Web;
  
  using System.Web.WebPages;
  </code></pre>
  
  <p>And then trying to use <code>WebPageExecutingBase.Href()</code>, but while the "WebPageExecutingBase" part shows up in Intellisense, the "Href()" does not (and, in fact, generates a server-side error demanding a second 'object' argument, but I have used this same method with only one argument multiple times before).</p>
  
  <p>I have tried to look up info on it here:  <a href="http://msdn.microsoft.com/en-us/library/system.web.webpages.webpageexecutingbase(v=vs.111).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.web.webpages.webpageexecutingbase(v=vs.111).aspx</a> But to no avail.</p>
  
  <p>I thought I had this right, but now I'm not even sure if I can use this method here at all.  </p>
  
  <p>Is there any way to implement the <code>Href()</code> method (or the same functionality therein) within HTML generated in a string in a <code>.cs</code> C# file?</p>