@amjad.sahi, @Professionalize.Discourse, @John.He, @simon.zhao
Please give a quick reply
Storing license files in ASP.NET apps: how to use the path and which directory to add.
@amjad.sahi, @Professionalize.Discourse, @John.He, @simon.zhao
Please give a quick reply
Storing license files in ASP.NET apps: how to use the path and which directory to add.
Cause
When it comes to storing your OEM license file securely in an ASP.NET application, it is crucial to choose a location that minimizes user access while ensuring your application functions properly.
Solution
A recommended approach is to store the license file outside of the web root directory. This prevents direct access via a web browser. You can place the license file in a secure folder within your application directory or in a completely separate directory that is not accessible from the web.
Code
Here’s a simple example of how to load the license file from a secure location:
// Assuming the license file is stored in a folder named "Licenses" at the root of your application
string licensePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Licenses", "your_license.lic");
License license = new License();
license.SetLicense(licensePath);
Ensure that the folder permissions are set correctly to restrict access to only the necessary application processes.
Next Steps
If you follow these steps, your OEM license file will be securely stored, minimizing the risk of unauthorized access. Please let me know if you need further assistance!
@imparthgalani
Please store license files outside your web root (e.g., App_Data or a custom folder) to prevent direct public access. Use server-side code to read the file.
Regarding how to set a license, it can be done through the path and stream object. Please refer to the following document.