title: Bytes[] to temporal PDF file to show in <object> html tag in ASP.NET
body: <p>How do i generate a temporal PDF in my ASP.NET application so I get an temp URL for a generated PDF from an array of bytes ?</p>
  
  <p>I use this but i think it could get simple:</p>
  
  <pre><code>//bytes[] arrayPDF exists before
  string fileName = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".pdf";
  File.WriteAllBytes(fileName, arrayPDF);
  
  HtmlGenericControl obj = new HtmlGenericControl("embed");
  obj.Attributes.Add("src", fileName);
  obj.Attributes.Add("style","border-radius: 10px;position: relative;top:0;right:0;left:0;bottom:0;width:100%;height:620px;");
  obj.Attributes.Add("height","600");
  obj.Attributes.Add("type", "application/pdf");
  form1.Controls.Add(obj);
  </code></pre>
  
  <p>My main problem is <strong>how to generate a temp file that i am sure that it would not stay in the server more than the request/show time</strong></p>