Free Support Forum - aspose.com

Web Application

When I am trying the setlicense() method in Global.asax--->Session.Start() method I am getting the below error in the second line given below(C#)

var license = new Aspose.Word.License();
license.SetLicense(_licensePath.Trim());


This message was posted using Aspose.Live 2 Forum

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please be more specific regarding the problem you are observing? Could you please provide me details of the exception? Please attach stack trace of the exception.

I cannot reproduce the problem on my side using the latest version of Aspose.Words (9.3.0).

I use the following code for testing:

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

lic.SetLicense(@"C:\Temp\Aspose.Words.lic");

Best regards,

No, it is working fine when I am putting the code in Application_Start() in Global.aspx. But I am getting the error when I am putting the code in Session_Start() event in Global.aspx page.

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Please see the following link to learn where to apply the license:

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

When developing an ASP.NET application, you should call License.SetLicense from the Global.asax.cs (not from the Global.aspx) file, in the Application_Start protected method.

May I ask you, why do you need to call SetLicense from the Session_Start()?

Best regards,