title: Creating a .NET StreamWriter object from classic ASP - constructor parameter problem
body: <p>I'm trying to create and use a .NET StreamWriter object inside a classic ASP page (VBScript).  Normally I would create the object like this:</p>
  
  <pre><code>Dim writer
  Set writer = Server.CreateObject("System.IO.StreamWriter")
  </code></pre>
  
  <p>However, the constructor for StreamWriter takes a Stream object as a parameter, and the call to CreateObject fails. Even if I could get a parameterless constructor to execute without error, the BaseStream property of the StreamWriter class is read-only, so I couldn't set it to my Stream after object creation.</p>
  
  <p>Is there a way to specify constructor parameters when doing interop from VBScript to .NET in this way?  And no, doing this doesn't work:</p>
  
  <pre><code>Set writer = Server.CreateObject("System.IO.StreamWriter", stream)
  </code></pre>
  
  <p>My alternative would be to create my own .NET wrapper class with a paramterless constructor and register that assembly for COM interop, but I'd like to avoid that if it's not necessary.</p>