Free Support Forum - aspose.com

How Aspose.Cells for .Net SetLicense search for a license path?

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi,

Aspose.Cells for .NET does not look for license on specific path or in specific order. It looks for a license on the path you mentioned.

Suppose you mention this path C:\myFolder\License.lic then Aspose.Cells for .NET will look for license in the C:\myFolder.

Suppose you don’t mention the path in the set license. Then it will look for license in the current directory.

Please see the code below, in this code, I have not mentioned the complete path, now Aspose.Cells for .NET will look for it in the current directory. Please see its output

C#

//If you will not mention the path Aspose.Cells for .NET will look for it

//in current directory

License lic = new License();

lic.SetLicense("License.lic");

//Will print the path of current directory

System.Diagnostics.Debug.WriteLine("Aspose.Cells will look for \"License.lic\" on this path: " + Environment.CurrentDirectory);

Output:

Aspose.Cells will look for "License.lic" on this path: F:\Shak-Data-RW\Projects\AsposeProject\AsposeProject\bin\Debug


An additional note for Asp.NET application, suppose, if you have placed a license file in your virtual directory and your virtual directory is at this path F:\Shak-Data-RW\Projects\AsposeProject\AsposeWebSite\ and you have placed a license at this path F:\Shak-Data-RW\Projects\AsposeProject\AsposeWebSite\License.lic, then you will use the following code to access it.

C#

string pathLicense = Server.MapPath("~") + "\\License.lic";

License lic = new License();

lic.SetLicense(pathLicense);