Thank you for your purchase.

The following tutorial will help you configure your application correctly and put the license file in appropriate place.

License file ("MailLicense.xml" you received after purchase via email or download link) is loaded from the run folder of your application (AppDomain.CurrentDomain.BaseDirectory).

Configuring license file in Visual Studio

In Visual Studio 2005, 2008, 2010, 2012, 2013, 2015 you can configure "MailLicense.xml" file in your project, so it's always copied to your output directory:

  1. Right click on your project in Visual Studio in Solution Explorer.
  2. Click "Add" then "Existing item..."
  3. In "Files of type:" combo choose "All Files (*.*)".
  4. Browse to "MailLicense.xml" file and click "Add" button.
  5. Right click on "MailLicense.xml" file in Solution Explorer and click "Properties".
  6. On Properties pane change "Copy to Output Directory" option to "Copy if newer".

Copy license to output folder

ASP.NET and WebServices

"MailLicense.xml" should be in the root folder of your web application (the folder with the "web.config" file).

WindowsServices

"MailLicense.xml" should be in the run folder of your windows service. By default it is the folder your service's .exe file resides.

Please use the LicenseHelper described below to check the exact path.

ClickOnce

First configure the license file so it's copied to the output directory as described above.

  1. Right click on your project in Visual Studio in Solution Explorer.
  2. Select "Properties"
  3. Go to "Publish" tab
  4. Click "Application files..."
  5. Configure "MailLicense.xml" file
  6. Set "Publish Status" to: "Include"
  7. Set "Download Group" to "Required"

ClickOnce license file deployment

Security

Remember also that your application needs to have read access to this file. It is especially important when, for example, you are developing WindowsService that runs on specific Windows account. Please make sure that the user in context of which the service is running has enough permissions to access to this file.

Library uses following code to assert that it has permissions to read the file:

Checking license status

License file is read once per application-run, so remember to restart your application after placing the file in appropriate folder.

You can use LicenseHelper class to obtain the exact path, and the current status of the license:

Machine key store

In rare cases when you use impersonation you'll need to put the following line in your application start up code (e.g. in Global.asax in Application_Start method). It tells .NET runtime to persist keys in the computer's key store instead of the user profile store.

Next steps