"Invalid license filename or its path!" Error

Keep getting this error using the following code with the lic file in the same folder as the calling method:

string licenseFile = “Aspose.Recurrence.lic”;
Aspose.Recurrence.RecurrenceBase.SetLicense(licenseFile);

Hi,

Where did you place Aspose.Recurrence.lic?

Probably your code can’t find it.

As I stated in the first post - in the folder of the calling method.

Calling method folder: /Compliance-Trak/PortalCSVS/Admin/AddServiceStandard.aspx.cs

Recurrence license folder: /Compliance-Trak/PortalCSVS/Admin/Aspose.Recurrence.lic

Both of these are in the “Admin” folder!

Thanks, D-

Hi,

For the code in your first post, I guess the Aspose.Recurrence.lic should be placed in your Bin folder of your application, say, the same folder as your dll/exe file, because your application locates the license file in a folder at run time, not design time. So, if you don’t specify its path, like your code, your application assumes the license file is in its same folder by default.

By the way, you can rename the license filename or you can place it into any folder once your code has a correct reference to it.

Hi,

I certainly recommend you always figure out and pass fill file name (including path) of the license file. I think this is especially important for web applications.

Normally, you will find that if the license file is in the same folder as your exe/dll - then file name without path will work, but not always! It works only if the current folder for the process corresponds to the path of the executable (this is default when the process is started). However, current folder for the process can be changed, and for a web application current folder can be folder of the IIS server process (pointing to somewhere Win\System32 folder) or maybe folder of the ASP.Net executable - who knows…

For my Win programs I normally do this:

string fullFileName = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + fileName;

For Web applications you need to do something similar, I cannot remember exactly what, look for details in the API for HttpSession, HttpServer objects, maybe there.