我现在用vs2003做了一个b/s模式的软件,现在想通过在用户登陆的时候,先检测用户注册表,检测其是否已经注册过,如果没有注册的话,就自动跳到注册页面进行注册,想获取cpu序列号,我看了网上的,都是c/s模式的,那样的话,是获取的客户端的硬件,那样是不行的啊,请问大家,有没有什么好的解决方案啊,只要是有效的,都给分
解决方案 »
- 火狐下response.write无法提交表单(急,100%给分)
- Gridview行单击事件
- 关于select的绑定问题
- 不好意思,没分了.asp.net 下载问题,用户下载保存完成后.就不执行别的代码了,怎么办?
- FormsAuthentication的问题
- 再发一贴:还是取gridview“列索引值” 为了把这个问题整明白 放100分
- OA短消息提醒功能功能怎么实现
- 请问dataGrid中点击“修改”后,如何得到要修改的行的记录值?(急)
- 【被押宝游戏害惨了】
- 在AD中哪一项是存储用户密码的?或者怎么取得用户密码?
- 在aspx页面中怎么调用js文件,js文件是显示日期的
- |M| 今天第一次用到SQL的视图,说说我的看法大家看对不对
设置一个试用期,试用期过后提醒用户!
不要用C/S的模式来做B/S
{
System.Security.Cryptography.MD5CryptoServiceProvider obj = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] b = System.Text.Encoding.Default.GetBytes(sInput);
b= obj.ComputeHash(b,0,b.Length);
string res ="";
for (int i=0;i<b.Length;i++)
{
res += b[i].ToString("X").PadLeft(2,'0');
}
obj = null;
return res;
}
就直接用登陆验证就可以了呀
把用户写在一个用户表中
www.nov30th.com#$@%$#$@123333333 这些当然不能让客户知道的,最后用SHA1或者MD5放入数据库。(域名,加密后的字符串)启动时把域名和加密的对比(即重新加密域名和数据库的对比。这个要同时读取,不要使用WHERE,防止用户用SQL监视,否则不写入APP变量)读到App网站全局变量中。 有访问时判断即可。否则为非授权的使用。这个是我的思路。顺便接分
using System;
using System.IO;
using System.Security.Cryptography;namespace bh
{
/// <summary>
/// Security 的摘要说明。
/// </summary>
public class Security
{
const string KEY_64 = "xxxxxxxx";
const string IV_64 = "xxxxxxxx"; //注意了,是8个字符,64位
public Security()
{
//
// TODO: 在此处添加构造函数逻辑
//
}public static string Encode(string data) //加密
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(KEY_64);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV_64); DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
int i = cryptoProvider.KeySize;
MemoryStream ms = new MemoryStream();
CryptoStream cst = new CryptoStream(ms,cryptoProvider.CreateEncryptor(byKey,byIV),CryptoStreamMode.Write); StreamWriter sw = new StreamWriter(cst);
sw.Write(data);
sw.Flush();
cst.FlushFinalBlock();
sw.Flush();
return Convert.ToBase64String(ms.GetBuffer(),0,(int)ms.Length); } public static string Decode(string data) //解密
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(KEY_64);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV_64); byte[] byEnc;
try
{
byEnc = Convert.FromBase64String(data);
}
catch
{
return null;
} DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
MemoryStream ms = new MemoryStream(byEnc);
CryptoStream cst = new CryptoStream(ms,cryptoProvider.CreateDecryptor(byKey,byIV),CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cst);
return sr.ReadToEnd();
}
}
}