不过还是有问题~~我按照这个算法计算出来的注册码不能注册
下面的市源代码
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
public class Program
{
private string code;
private string key;
private string regcode;
private string webUrl;
public Program()
{
}
public Program(string url)
{
this.webUrl = url;
}
public Program(string regcode, string code)
{
this.code = code;
this.regcode = regcode;
}
internal string Creat_Code(string s)
{
s = s.Replace("http", "");
s = s.Replace("/", "");
s = s.Replace(":", "");
s = s.Replace(".", "");
s = s + "goodkdhfd%$$h";
string str = this.MD5_Method(s);
string str2 = str.Substring(1, 5);
string str3 = str.Substring(6, 5);
string str4 = str.Substring(11, 5);
string str5 = str.Substring(0x10, 5);
return (str2 + "-" + str3 + "-" + str4 + "-" + str5);
}
public bool Is_reg()
{
string host = HttpContext.Current.Request.Url.Host;
if (host.ToUpper().Contains("LOCALHOST") || host.Contains("127.0.0.1"))
{
return true;
}
string s = ConfigurationManager.get_AppSettings()["weburl"].ToString();
return (ConfigurationManager.get_AppSettings()["key"].ToString() == this.strkey(this.Creat_Code(s)));
}
internal string MD5_Method(string strSource)
{
return FormsAuthentication.HashPasswordForStoringInConfigFile(strSource, "MD5");
}
public bool reg(Program p)
{
string str = this.Creat_Code(p.regcode);
if (p.code == str)
{
DB.SetValue("key", this.strkey(str));
return true;
}
return false;
}
internal string strkey(string str)
{
return this.MD5_Method(str.Substring(5)).Substring(10, 20);
}
public string Code
{
get
{
return this.code;
}
set
{
this.code = value;
}
}
public string Regcode
{
get
{
return this.regcode;
}
set
{
this.regcode = value;
}
}
public string Weburl
{
get
{
return this.webUrl;
}
set
{
this.webUrl = value;
}
}
}
按照这个算法的话我用192.168.0.168做域名,最终S=1921680168goodkdhfd%$$h
经过MD5加密以后就市fb68d 96173 a0c96 43754 d830f 527cc d7(空格我自己加的)
那它的注册码应该是b68d9-6173a-0c964-3754d
可是注册确是失败的,能告诉我市为什么吗?