Register Syncfusion® License key in ASP .NET Core EJ2 application

17 Jul 20262 minutes to read

Syncfusion® license key should be registered if your project uses Syncfusion® ASP.NET Core packages from NuGet.org or the Syncfusion® installer. The generated license key is a string that needs to be registered before any Syncfusion® control is initialized. The following code is used to register the license.

Registering a single license key

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

Registering multiple license keys

You can register multiple license keys using either a comma (,) or a semicolon (;) as the separator between keys.

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY_1,YOUR LICENSE KEY_2,...");

or

Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY_1;YOUR LICENSE KEY_2;...");

NOTE

  • Place the license key between double quotes. Also, ensure that Syncfusion.Licensing.dll is referenced in your project where the license key is being registered.
  • Ensure the Syncfusion.Licensing namespace is available in the file where you register the license key.
  • Syncfusion® license validation is done offline during application execution and does not require internet access. Apps registered with a Syncfusion® license key can be deployed on any system that does not have an internet connection.

For ASP.NET Core application using .NET 8.0 or .NET 9.0

Register the license key in the Program.cs file if you created the ASP.NET Core web application with Visual Studio 2022 and .NET 8.0 or .NET 9.0.

var app = builder.Build();
// Register Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY");

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}