License

Namespace: ASPSecurityKit
Assembly: ASPSecurityKit.dll

Summary

Provides methods to register and validate a license. To learn more visit https://ASPSecurityKit.net/docs/license/

Methods

Register(keyData)

Summary

Attempts to register a license key using the specified string key.

Parameters
Name Type Description
keyData System.String The license key string.
Exceptions
Type Description
System.ArgumentNullException When keyData is null or whitespace.

RegisterFromFile(filePath)

Summary

Loads and Registers a license key from the given file path.

Parameters
Name Type Description
filePath System.String The license file path.
Exceptions
Type Description
System.ArgumentNullException When filePath is null or whitespace.
System.IO.FileNotFoundException When file specified by filePath could not be found.
System.InvalidOperationException When the specified file doesn’t contain a valid license key.

RegisterFromExecutionPath(fileName)

Summary

Looks for the license file by the specified name in the potential execution paths (relative to current directory/httpRuntime.AppDomainAppPath/EntryAssembly.Location and inside app_data/bin/etc.), loads and registers the license key from first such file found.

Parameters
Name Type Description
fileName System.String The license file name (including file extension). Default to “AskLicense.dat” if not specified.
Exceptions
Type Description
System.ArgumentNullException When fileName is null or whitespace.
System.IO.FileNotFoundException When no file could be found by the given name in any of the potential execution paths attempted.
System.InvalidOperationException When a file was found by the given name but it did not contain a valid license key.

TryRegisterFromExecutionPath(fileName)

Summary

A wrapper around RegisterFromExecutionPath which suppresses FileNotFoundException.

Returns

true If registration was successful; otherwise, false.

Parameters
Name Type Description
fileName System.String The license file name (including file extension). If not specified, tries both “AskLicense.dat” and “AskTrial.dat” (in that order).

AssertIsValid()

Summary

For internal consumption only.

Parameters

This method has no parameters.