纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
864 B

using System.Configuration;
using System.Web;
namespace NFine.Code
{
public sealed class Licence
{
public static bool IsLicence(string key)
{
string host = HttpContext.Current.Request.Url.Host.ToLower();
if (host.Equals("localhost"))
return true;
string licence = ConfigurationManager.AppSettings["LicenceKey"];
if (licence != null && licence == Md5.md5(key, 32))
return true;
return false;
}
public static string GetLicence()
{
var licence = Configs.GetValue("LicenceKey");
if (string.IsNullOrEmpty(licence))
{
licence = Common.GuId();
Configs.SetValue("LicenceKey", licence);
}
return Md5.md5(licence, 32);
}
}
}