I am trying to create a pptx presentation in pieces (because of memory constraints). To do this, I am trying to write the pptx pieces to our production server. When the files are to be written to the server, the following error appears:
Access to the path '\\rtselp-fs01\...\Annex B, Section 9_0.pptx' is denied.
There are two different ways that I write the output to the server:
Public Shared Sub writeFilePPTx(ByVal pres As PresentationEx, ByVal sFile As String)
Dim sFN As String = "attachment; filename=" + sFile
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
HttpContext.Current.Response.AppendHeader("Content-Disposition", sFN)
HttpContext.Current.Response.Flush()
Dim st As Stream = HttpContext.Current.Response.OutputStream
pres.Write(st)
HttpContext.Current.Response.End()
End Sub
Public Shared Sub writeFilePPTxContinue(ByVal pres As PresentationEx, ByVal sFile As String)
Dim oFS As Stream
oFS = New FileStream(sFile, FileMode.Create, FileAccess.Write)
pres.Write(oFS)
oFS.Close()
End Sub
The first method (writeFilePPTx) lets the user pick the location for the file and will drop the file in the directory which the second process uses. The second process (writeFilePPTxContinue) is used to dump each piece in the server directory. I don't know why the first will work and the second gives the 'access denied' error.
We are using Windows Authentication. Should I be using something besides FileStream to build the files?
Thanks for any help.