Free Support Forum - aspose.com

Getting error when accessing license file using Aspose.Words

Hi,

I am using Aspose.Words (Ver 9.3.0.0) for .Net to convert docx file to html file. But I am getting an exception while reading the license file. Please find the error below.

Cannot find license '\\stgintraweb\STGINTRANETHTDOCS\intranet\apps\depts\TGS\ASG\TR\TravelCSQAdmin\License\Aspose.Total.lic'. at x28925c9b27b37a46.x220f433da4115056.xde6236852622c268(String x1c1fc72fe1a3b4ea, Assembly x39e0a96279c40baa) at x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4) at Aspose.Words.License.SetLicense(String licenseName)

I have tried for various solutions.

1. I have copied the license file into the bin folder that contains assemblies of my project and have created an object of the Aspose.Words.License class and called the SetLicense method passing only the file name of the license file without path as below:

Aspose.Words.License license = new Aspose.Words.License();<?XML:NAMESPACE PREFIX = O />

license.SetLicense("Aspose.Words.lic");

2. I have done the impersonation for reading the file.

Both the solutions doesn't work out.

Could someone help me.

Thanks and Regards,

Swapna

Hi

Thanks for your request. I think, you can try to read your license into stream and then apply it from stream:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.license.setlicense_overload_2.html

Hope this helps.

Best regards,

Hi
I have tried to read the license into stream and then applied it from stream. Please find the code which i have used.

License license = new License();
FileStream fileStream = new FileStream(Server.MapPath("~") + "\\bin\\Aspose.Total.lic", FileMode.Open, FileAccess.Read);
license.SetLicense(fileStream);


I am getting the following error.

Access to the path '\\stgintraweb\STGINTRANETHTDOCS\intranet\apps\depts\TGS\ASG\TR\TravelCSQAdmin\bin\Aspose.Total.lic' is denied.

Could you please help me.

Thanks and Regards,

Swapna

Hi Mary,


Thanks for the additional information.

Using your code, I was unable to reproduce this problem on my side. It seems your ASP.Net application is not having enough access permissions on the folder containing your license file.

In order to resolve this problem, I would like to suggest you the following work around:

1) Place Aspose.Words.lic on the root directory of your web site as shown below:


2) Open Global.cs and in Application_Start event paste the following code that worked for me:

void Application_Start(object sender, EventArgs
e)
{
Aspose.Words.License
license = new Aspose.Words.License();
FileStream
stream = File.Open(Server.MapPath("~/Aspose.Words.lic"), FileMode.Open);
license.SetLicense(stream);
}

I hope, this will help.

Best Regards,