title: Cassic ASP in VB Redirect issues
body: <p>I've inherited a classic ASP site that has developed an odd problem. At the top of the page its redirecting to https for a secure connections. The code is:</p>
  
  <pre><code>&lt;%
  Response.Buffer = True
  
  ' Redirect to SSL if needed:
  servername=Request.ServerVariables("SERVER_NAME")
  scriptname=Request.ServerVariables("SCRIPT_NAME")
  serverport=Request.ServerVariables("SERVER_PORT")
  
  if serverport="80" and (InStr(servername, "192.168.1.") = 0 and servername &lt;&gt; "localhost")  then
      Response.Redirect "https://www.theurl.com" &amp; scriptname &amp; "?package=" + Request.QueryString("package")
  else
      'response.Write("Development testing")
  end if
  
  %&gt;
  </code></pre>
  
  <p>This code is at the top of the file. Nothing is before this. When I open the browser and load up the page I age a:</p>
  
  <pre><code>Response object error 'ASP 0156 : 80004005'
  
  The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content. 
  </code></pre>
  
  <p>No redirect happend. If I reload the page or go away and come back after the error then everything works just fine until I close the browser and reopen it.</p>
  
  <p>If this is at the top of the file how can the headers already be written?</p>
  
  <p><strong>Update:</strong> The full source as provided by IE8's view source:</p>
  
  <pre><code> &lt;font face="Arial" size=2&gt;
  &lt;p&gt;Response object&lt;/font&gt; &lt;font face="Arial" size=2&gt;error 'ASP 0156 : 80004005'&lt;/font&gt;
  &lt;p&gt;
  &lt;font face="Arial" size=2&gt;Header Error&lt;/font&gt;
  &lt;p&gt;
  &lt;font face="Arial" size=2&gt;/path/file.asp&lt;/font&gt;&lt;font face="Arial" size=2&gt;, line 10&lt;/font&gt;
  &lt;p&gt;
  &lt;font face="Arial" size=2&gt;The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
  &lt;/font&gt; 
  </code></pre>
  
  <p>Yes the space before