I am using Aspose.Words 6.3.0.0 in an ASP.NET application that is being used by 40+ companies. The application can generate Word documents and / or convert Word documents to PDF. This has worked for over 8 years without any problems. Only recently one client is having some problems and I can’t determine why. I have been unable to reproduce the problem, as it happens randomly. I will try to explain the situation:
I have a ASP.NET datagrid that lists all files in a specific folder. The user can generate a Word document that is being placed in that folder. After generating the Word document they can choose to make a PDF copy. The user also has the option of opening the folder directly (link to network share).
As said, sometimes - not always - the following happens:
- User creates the new Word document. Page reloads, datagrid shows the Word document.
- User presses button to make a PDF copy. Page reloads, shows both the Word and the PDF document.
- User tries to open the PDF document (link to file on network share, f.e. \server\folder\document.pdf), but document can’t be found.
- User presses link to open the network share in Windows Explorer, only the Word document is there.
- After a few minutes, or after other activity, the file shows up in Windows Explorer and the user can open the file.
What I don’t understand is that the ASP.NET application can see the file, otherwise it wouldn’t show up in the datagrid, but that the user cannot see the file (or open it).
It is very hard to troubleshoot this problem, because I cannot reproduce it and when the client contacts me when this happens the file usually shows up before we have a teamviewer session up and running, or the file appears the moment I do something.
The code to read the contents of the folder is:
--------
Dim fileInfoArray() As FileInfo = dirInfo.GetFiles(".")
Array.Sort(fileInfoArray, New CompareFileInfoEntries(compareMethod))
Me.dgFileList.DataSource = fileInfoArray
Me.dgFileList.Columns(4).Visible = boolPopUp
Me.dgFileList.DataBind()
--------
The code to convert the Word document to a PDF is:
--------
Dim license As License = New License
license.SetLicense(System.Web.HttpContext.Current.Server.MapPath(“License”) + “\Aspose.Words.lic”)
Dim doc As New Aspose.Words.Document(Me.ddlBestandsBeheerDirectories.SelectedValue & strFileName)
doc.Save(String.Format("{0}{1}", Me.ddlBestandsBeheerDirectories.SelectedValue, Replace(strFileName, “.doc”, “.pdf”)), Aspose.Words.SaveFormat.Pdf)
--------