Access denied for pdf to read using itextsharp at server level..

Posted by apekshabs on Stack Overflow See other posts from Stack Overflow or by apekshabs
Published on 2009-03-08T07:06:36Z Indexed on 2010/06/09 2:02 UTC
Read the original article Hit count: 302

Filed under:

Am facing error after uploadind to server... as access denied .... can anyone help me....

  Document myDocument = new Document(PageSize.A5, 26, 72, 180, 180);
  string strUniqueFn = "onlineinvoice.pdf";
  string imgpath = "logo.gif";    



  string strUser = Thread.CurrentPrincipal.Identity.Name.Substring(Thread.CurrentPrincipal.Identity.Name.IndexOf("\\") + 1).ToUpper();
  string strFolder = Server.MapPath(".");
  System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(strFolder);
  System.IO.FileInfo[] fi = di.GetFiles(strUser + "*.*");

  for (i = 0; i <= fi.Length - 1; i++)
  {
      System.IO.File.Delete(strFolder + "\\" + strUniqueFn);
  }

  string strPath = strFolder + "\\" + strUniqueFn;

  PdfWriter pdfw = PdfWriter.GetInstance(myDocument, new FileStream(strPath, FileMode.Create));
  string iPath = strFolder + "\\" + imgpath;
  pdfw.CloseStream = false;

  myDocument.Open();

  ......................

  myDocument.Close();

Am facing error at PdfWriter pdfw = PdfWriter.GetInstance(myDocument, new FileStream(strPath, FileMode.Create));

can anyone help me...

Thank you

© Stack Overflow or respective owner

Related posts about c#