在Web应用程序上许可模块

Fil*_*erg 2 .net licensing

假设您有一个网站,其中包含许多不同的模块,例如:

  • 会计(处理客户,发票等)
  • 备注和文档(创建和管理您的文档)
  • 还有很多..

如果一个客户没有相应的许可证,您如何限制访问其中一个"模块"

我经常看到.lic文件附带的组件,你如何生成其中一个?

如果你使用这样的方法会影响性能吗?

编辑

我想到的另一件事是,如果您将所有模块与您的应用程序一起发送,并且您只想显示已获得许可的控件,您是否需要检查每个控件的有效性,还是以某种方式提取该信息?

dna*_*dna 5

您可以使用现有的一个开源解决方案来生成和验证许可证文件,包括有关允许的模块/功能的信息:

Boths工具允许您将其他数据存储到许可文件中 - >在您的情况下允许模块.

使用Portable.Licensing解决方案,您可以使用产品功能或其他许可证数据来添加允许的模块:

var license = License.New()  
    //... other options
    .WithProductFeatures(new Dictionary<string, string>  
                              {  
                                  {"Accouting", "yes"},  
                                  {"Notes and Documents", "yes"}
                              })  
    // ... other options
    .CreateAndSignWithPrivateKey(privateKey, passPhrase);
Run Code Online (Sandbox Code Playgroud)

要验证模块:

if (license.ProductFeatures.Contains("Accouting"))
    // ...
Run Code Online (Sandbox Code Playgroud)

免责声明:我是Portable.Licensing开源项目的作者