Windows authentication when writing presentationex

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.

Hi Brad,

I have discussed the shared issue with our development team and we feel that there is something with security settings on the server. Both your application and Aspose.Slides for .NET don't have access to write to the output stream. Can you please verify the security settings on your end. You can double check Aspose.Slides for .NET response with streams on local machine for assurance as well and you will find the streams working properly.

Thanks and Regards,

Thanks for the reply Mudassir.

Again, the first function is able to write the file to the same server directory that the second function can not. To me that means that the server will allow access with the first routine, but not the second.

Since we are using Windows Authentication, that seems to mean that the first routine is sending the correct Windows credentials (automatically somehow), but the second is not. I tried to force the credentials into the FileStream, but could find no way to do so.

I noticed in some other posts that FileOutputStream was used instead of FileStream and thought that maybe that was the difference. FileOutputStream was not recognized by Intellisense, so I don't know where it comes from and whether it might work.

Just thought you might know the answer.

Hi Brad,

I am sorry for your inconvenience.

As I have shared earlier that I have discussed this issue with our development team and we feel it's an issue of access for writing. You are right in making your point that first method is somehow able to write to streams as it may be automatically be picking up the Windows Authentication for this. The second, method might have failed due to access rights. I would suggest that you may please revisit your server configuration for this.

Thanks and Regsards,