We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Best way to include license in ASP.NET projects


I need to use Aspose.Email to send SMTP message. Have a questions regarding setting license:

  • Is it OK to simply put Aspose.Total.lic in Bin sub-folder of the website? My concern is that file content is not encrypted and license can be viewed/copied by anyone having access to the machine. Maybe you have some requirements on license file usage. In WinForms applications I can embed license file directly into application .EXE file

Hi Alex,

Thank you for your inquiry.

You can put the license file in the Resources folder under your web project and add the following lines of code before calling any functionality of the API.


string path = MapPath(".");
path = path.Substring(0, path.LastIndexOf("\\"));
path = path + "\\Resources\\Aspose.Pdf.lic";
// This is how you can get the path to the file.
Aspose.Email.License license = new Aspose.Email.License();
// This is how you set the license.

Hi Alex,

You may please encrypt the license file using some encryption scheme with own key as given here. Read the entire license file into string, encrypt it and save it in some file (or may be, this string can be placed in the code). Once the file is encrypted, place this encrypted file on the server machine where site is hosted.

Now in the Application_Start() function of website, read this encrypted string from file and decrypt it. Then copy this decrypted string to MemoryStream and use this memorystream object in the SetLicense() function.

Please give it a try and share the feedback.