We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Download a dynamically generated Word Doc

Hi there, I am updating an application that was previously on a Windows 2008 server and since has been upgraded to 2012. Since the migration to the new server we are getting a security error (note no code has changed). The Error is:

Access to the path ‘c:\windows\system32\inetsrv\Test_Drag_N_Drop_09-26-2014_Minutes.doc’ is denied.

Looking at the code, it is essentially this:
doc = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)

…Add a bunch of stuff to the document. here…

Dim minutesDocName As String = HttpContext.Current.Server.UrlEncode(
minutesMeeting.MeetingName.ToString.Replace(" ", ""), _
Format(minutesMeeting.MeetingDate, “MM-dd-yyyy”)) _
doc.Save(minutesDocName, SaveFormat.Doc) <— ERROR OCCURS ON THIS LINE

Note: No path is supplied, it just saves with the generated file name. (I assume it just saves to memory for the download)

On the old server this works and it pops up a download dialogue box. I could add credentials to the system32 folder but that doesn’t seem right. The old server doesn’t have special permissions on this folder either.

Any help is appreciated, thanks,


Quick Note: Aspose.Words version is 13.1


Any Insight on this one?

Hi Coty,

Please accept my apologies for late response.

Thanks for your inquiry. Could you please change the path of your output file e.g c:\temp\out.doc and let us know if you still face the exception? Please make sure that you have set the write access permissions for directory in which you are writing the output document. You may check this by using .NET I/O classes.

Updating the path did allow the file to save, I’m not sure why it worked one way on the other server and didn’t on the new server. (the save action still didn’t open the download dialogue box/or download the file though). I’m not sure if there was a handler that wasn’t working or what. To fix I added an update to the response:

With HttpContext.Current.Response
.AddHeader(“content-disposition”, _
String.Format(“attachment;filename={0}.doc”, _
HttpUtility.UrlEncode(_dlHelper.StripInvalidChars(minutesDocName))) _
.ContentType = “application/msword”
End With

The download worked after.



Hi Coty,

Thanks for your feedback. It is nice to hear from you that you have found the solution of your issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.