Setting License for Aspose.Slides using HTTP Module

Hi.

[Please refer my earlier post In my application, I am using HTTP module to register the License using the following code.

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

license.SetLicense(httpApp.Context.Server.MapPath("~") + "\\" + licenseName);

The above piece of code runs for every request to my application by the user. So license is set everytime user hits my application. Manytimes, I am getting NullReferenceException (in the SetLicense call) in the place where the object can't be null at all. Is there any other way to call SetLicense as static method (so that it will be called only once when my application is hit for the very first time)? Will this be a solution to my problem? Please suggest.

Dear Edin,

As I have shared earlier in the referenced thread that the NullReferenceException is thrown in the place where the object can't be null at all. We feel, the only possible reason is that another thread set it to null. So, at first please try to synchronize SetLicense calls and remove all unnecessary license initializations in case it exists in your code. You may please test the scenario with a single thread call for assurance. We suggest you to try synchronizing your thread calls but first verify the fact in single thread environment.

Thanks and Regards,