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

Free Support Forum - aspose.com

Aspose.Words loses license on asp.net

We have been using Aspose.Words to convert documents to HTML and to PDF on an asp.net website. Very recently we've found that when the website has been running for some time (at least 2 days), it seems to lose its license info. Converting a document to html will throw an exception, and converting a document to pdf will insert a watermark stating that the trial version of Aspose is being used. Restarting the website makes the problem go away. We have not changed our code or the aspose.words dll recently. Is there any explanation for this behavior?

Hello

Thanks for your request. There should not be any problems with license. Please make sure that you applied license as described here:
http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/applying-a-license.html

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/when-to-apply-a-license.html

Also as a variant, you can try using code like the following to check whether license is set or not:

///

/// Returns true if the Aspsoe.Words license is set.

///

private static bool IsLicenseSet()

{

// We will insert this text at the beggining of the document.

// If the license set this text will be in th efirt paragraph,

// if not an evaluation watermark will be in the first paragraph.

const string text = "This is text used to check if the license is set";

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write(text);

// Save and open the document. If Aspose.Words works in evaluation mode it will add a watermark.

using (MemoryStream docStream = new MemoryStream())

{

doc.Save(docStream, SaveFormat.Doc);

docStream.Position = 0;

doc = new Document(docStream);

}

// Check text of the first paragraph.

return (doc.FirstSection.Body.FirstParagraph.ToTxt().Trim() == text);

}

Hope this helps.

Best regards,