title: Displaying a PDF with ADODB.Stream
body: <p>I'm working on replacing a system that primarily uses PDF files to give users their monthly reports.</p>
  
  <p>The problem I'm having is being able to prevent one user from seeing another's information. For example if user1 has a file at www.mysite.com/user1/file.pdf they could edit the URL to www.mysite.com/user2/file.pdf and see the files of user2.</p>
  
  <p>The way I've been trying to get around this is to disable anonymous access (it's an IIS server) to the user folders so it's impossible to get direct access to files and have view_file.asp bring in the file using ADODB.Stream. I'm having a problem though that some users have not been able to view the files. It seems to only be people using IE but it's hard to be sure.</p>
  
  <p>I basically just need to either fix this to work in all browser/configs or find an alternative way to display the file through the browser.</p>
  
  <pre><code>Set adoStream = CreateObject("ADODB.Stream")
  adoStream.Type = 1
  adoStream.Open()
  
  adoStream.LoadFromFile "C:/path-to-file/" &amp; curUser &amp; curDir
  
  Response.Buffer = true
  Response.CharSet = "UTF-8"
  Response.Clear
  Response.ContentType = "application/pdf"
  
  Do While Not adoStream.eos
      Response.BinaryWrite adoStream.Read(1024 * 8)
      Response.Flush
  Loop
  Response.End()
  adoStream.close
  Set adoStream=nothing
  </code></pre>