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

15 Apr 20251 minute to read

Syncfusion® license key should be registered, if your project using Syncfusion® ASP.NET Core packages refer from nuget.org or from syncfusion® installer. The generated license key is a string that needs to be registered before any Syncfusion® control is initiated. The following code is used to register the license.

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

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.
  • 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/.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 /.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();
}