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

Free Support Forum - aspose.com

License lost issue

We got an annoying license lost problem in our ASP.NET web application. Every once a while, the license warning text shows up on the file generated from Aspose component. The code we used to load license is like this


System.IO.Stream stream = SimpleFileHelper.GetStream(licpath);

Aspose.Words.License license = new Aspose.Words.License();


It resides in a method that will be called by Global.asax.cs's Application_Start. The Aspose.Words.dll we are using right now is


1) Please let me know why this happen and how to fix it.
2) Is there a way to determine whether license file is loaded or not? So at least we can log the environment information when license gets lost again instead of just get red text on generated document.

Hi there,

Thanks for your inquiry.

The license files come with an expiry date which determines whether you can free upgrade to a version of Aspose.Words that is published before or on that expiry date. Therefore, you always need to have a valid subscription to be able to use the latest released version of Aspose.Words. I suggest you please read following documentation link for your kind reference.

I have attached a sample WebSite that loads a license for Aspose.Words from a file in Application Start event and then determines whether the component is licensed or not. The code is written in Global.asax and Default.aspx.cs files. I hope, this helps.
Is there a why to determine whether license file is loaded or not? So at least we can log the environment information when license gets lost again instead of just get red text on generated document.
I am afraid, the License class doesn’t expose any built-in methods to check/track the status whether a license is properly applied or not. However, if you want to be sure, you can try creating your own custom method to do this job. To do this you could create a blank document and export this to a stream. Then reload this and check the first paragraph in the body for the evaluation message.


/// Returns true if the Aspose.Words license is set.<o:p></o:p>



private static bool IsLicenseSet()<o:p></o:p>


// We will insert this text at the beggining of the document.<o:p></o:p>

// If the license set this text will be in th efirt paragraph,<o:p></o:p>

// if not an evaluation watermark will be in the first paragraph.<o:p></o:p>

const string text = “This is text used to check if the license is set”;<o:p></o:p>

Document doc = new Document();<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder(doc);<o:p></o:p>


// Save and open the document. If Aspose.Words works in evaluation mode it will add a watermark.<o:p></o:p>

using (MemoryStream docStream = new MemoryStream())<o:p></o:p>


doc.Save(docStream, SaveFormat.Doc);<o:p></o:p>

docStream.Position = 0;<o:p></o:p>

doc = new Document(docStream);<o:p></o:p>


// Check text of the first paragraph.<o:p></o:p>

return (doc.FirstSection.Body.FirstParagraph.ToString(SaveFormat.Text).Trim() == text);<o:p></o:p>


Hello Tahir, Thank you for the quick response and your suggestion. We also have problem with Aspose.PDF, do you have any sample code to do license check for it?

Hi there,

Thanks for your inquiry. I am moving this forum thread to Aspose.Total forum. My colleagues from Aspose.Pdf team will reply you shortly about your query.


Thanks for contacting support.

I would like to answer from Aspose.Pdf perspective. If license for Aspose.Pdf for .NET is not initialized, a red evaluation watermark is added in PDF document. Once the file is generated, you can parse the contents and get the text from PDF file and match it with predefined evaluation watermark string "Evaluation Only. Created with Aspose.Pdf. Copyright 2002-2014 Aspose Pty Ltd."

For further details, please visit Search and Get Text from a Single Page of a PDF Document

Thanks for the suggestion.