Use multiple licenses in a single code base


This code sample explains how to register multiple license keys in a single code base.

Here is the web.config that includes a single license key for a PDFKit.NET 4.0 Server license:

1 <configuration> 2 <appsettings> 3 <add key="PDFKit.NET 4.0 Server Key" value="7206:JUm8jYm-4bwE84gi8RtQuk++" /> 4 </appsettings> 5 </configuration>

Now suppose that this web.config file is part of a project that is used to deploy to two different servers. In that case, it is possible to add a second key to the same web.config. Because a config file behaves like a dictionary, you must make the key attribute unique by adding a postfix. Our licensing code only checks if the key attribute starts with the expected string so the postfix may be anything. It will check all licenses until verification succeeds.

Here is the web.config file with the second key added:

1 <configuration> 2 <appsettings> 3 <add key="PDFKit.NET 4.0 Server Key SVR001" value="7206:JUm8jYm-4bwE84gi8RtQuk++" /> 4 <add key="PDFKit.NET 4.0 Server Key SVR002" value="3070:5RwUiW1lHWFEcteNiQFTy+++" /> 5 </appsettings> 6 </configuration>

Note the prefix of the key attribute. Although it can be anything, it is recommended to use something that makes sense.