title: Force a hyperlink to open in a new window using context.Response
body: <p>I have a web page having links to some pdf files, e.g. <a href="http://www.someurl.com/somefolder/filename.pdf" rel="nofollow">http://www.someurl.com/somefolder/filename.pdf</a>.</p>
  
  <p>When a user clicks on these links, authentication kicks in, user logs in and the file can be downloaded. What I'm trying to achieve is that the downloads open in a new window.</p>
  
  <p>I have a limited access/control to the code and can't put <code>target=_blank</code> attribute to href or add any javascript. The code that downloads after authentication is as below:</p>
  
  <pre><code>string filename = Path.GetFileName(context.Request.PhysicalPath);
  
  FileStream MyFileStream;
  long FileSize;
  
  string strMapPath = context.Server.MapPath(filename);
  MyFileStream = new FileStream(strMapPath, FileMode.Open);
  FileSize = MyFileStream.Length;
  
  //Allocate size for our buffer array
  byte[] Buffer = new byte[(int)FileSize];
  MyFileStream.Read(Buffer, 0, (int)FileSize);
  MyFileStream.Close();
  
  //Do buffer cleanup
  context.Response.Buffer = true;
  context.Response.Clear();
  
  //Add the appropriate headers
  context.Response.AddHeader("content-disposition",
  "attachement filename=" + filename);
  
  //Add the right contenttype
  context.Response.ContentType = "application/pdf";
  
  //Stream it out via a Binary Write
  context.Response.BinaryWrite(Buffer);
  </code></pre>
  
  <p>Can we possibly force <code>context.Response</code> to open in a new window?</p>