title: Block asp.net mvc Html creation in using scope
body: <p>I use an HTML helper that returns an IDisposable to create a specific DIV structure that I need very often in my application. The constructor of this class creates the open divs while the Dispose method created to closing Divs. Now I need to secure my application and I would like this structure not to be created in some condition but I also need that every kind of HTML that this produced between using and the end if its scope is also not rendered.</p>
  
  <p>First thing I did was to replace the TextWriter found int he ViewContext with dummy :</p>
  
  <pre><code>_helper.ViewContext.Writer = new StringWriter(new StringBuilder());
  </code></pre>
  
  <p>Its working for each piece of code that directly uses the ViewContext Writer to render HTML but not for the others (raw HTML and other helper)</p>
  
  <p>So the question is : How can we prevent a Asp.net view to render HTML within the scope of a using block ?</p>