Licensing

When to Apply a License

Follow these simple rules:

  • The license only needs to be set once per application domain.
  • You need to set the license before using any other Aspose.CAD classes.
  • Calling SetLicense multiple times is not harmful, but wastes processor time.
  • If you are developing a Windows Forms or console application, call SetLicense in the startup code, before using Aspose.CAD classes.
  • When developing an ASP.NET application, call SetLicense from the Global.asax.cs (Global.asax.vb) file, in the Application_Start protected method. It is called once when the application starts.
  • Do not call SetLicense from within the Page_Load methods since it means the license will be loaded every time a web page is loaded.
  • If you are developing a class library, you call SetLicense from a static constructor of the class that uses Aspose.CAD. The static constructor executes before an instance of your class is created making sure Aspose.CAD license is properly set.

Apply License using File or Stream Object

Use the License.SetLicense method to license the component. The easiest way to set a license is to put the license file in the same folder as the Aspose.CAD.dll and specify the filename, without a path, as shown below.

Loading a License from File

This code snippet initialize a license stored in a file or in an embedded resource.

Loading a License from a Stream Object

This code snippet initialize the license from stream.