Free Support Forum - aspose.com

Permission denied and license

I have two issues with my first wasted day of trying to code for apose.words.

I have 4 simple lines of code. 2 to set the license. and two to open and save a document.

Dim jkLicense As New Aspose.Words.License()

jkLicense.SetLicense("d:\clients\wpmt\aspose.words.lic")

This first line gives the error message that License is ambiguous in the aspose name space.

Dim saveAsFile As Object = Server.MapPath("tempFiles") & "\" & tempFile

Dim oDocMain As New Aspose.Words.Document(saveAsFile)

If I comment out the license file above. the file appears to open. When I try to save it I get a permission denied. The file name is corrrect. I am using impersonation for ASP.net rights. The user has all rights. I even temporarily made the user an administrator, but I still get permission denied errors. Does ASPOSE use a different user to give rights?

oDocMain.Save(saveAsFile, Aspose.Words.SaveFormat.Doc)

Hello

Thanks for your request. Maybe, you missed to add a reference to Aspose.Words in your application. I just tried with Aspose.Words 10.2.0 and all works fine on my side. I successfully added reference to the project and ran it without any issues.

Best regards,

I was able to remove the ambiguous error by removing the assembly from web.config.

Now I am getting an error "the License is invalid for this product". I recieved a temp license via email, by starting my order of the product.

I am stll getting the permission denied error.

Hi

Thank you for additional information. Please make sure the license is for Aspose.Words. Open your license in notepad, you should see the following:

Aspose.Words

Regarding permission error, have you tried to read your document into a stream and open Document from stream? Please try using code like the following:

// Read document to stream.

MemoryStream stream = new MemoryStream(File.ReadAllBytes("in.doc"));

// Open document from stream.

Document doc = new Document(stream);

The problem might occur because you application is running in medium trust and it is not allowed to read from file system. Have you tried to put your document into App_Data folder and read them from there?

Best regards,

Thank you for your help. I have resolved some of the issues.

The license issue and the append issue were resolved when I found an old dll on the server causing the issue.

I can now append documents. However I would like to append to the middle of the page, not starting a new page. In the interop software the command was insert formatted text(doc). Is there a way to get around this.

I tried opening up with a stream, but it will not cast the parameter. Maybe my translation of the c code to VB is the problem. Do you have a VB sampple of opening a doc with a stream.

I am adding a /v to my strings that I am appending with my run command. They are not formatting the doc, just printing. Do you know what I am doing wrong.

Thanks

Hi

Thanks for your request. If you would like to insert a document into another at a specific location, you can try using InsertDocument method. Please follow the link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-insert-a-document-into-another-document.html

Best regards,