有几个系统都共用一个User表,完全可以实现,很简单的代码,如下:
<authentication mode="Forms">
<forms name=".ASPXAUTH" protection="All" timeout="60" loginUrl="Login.aspx" defaultUrl="Default.aspx" />
</authentication>
<machineKey validationKey="CFAAD85CB1217AA132A01A640D815C5D02A47C72244D75D62AE62B6F3AC31FC26068CC248DB821BC74BA8A22516FF2197823B3C839432A1D588B" decryptionKey="340A3799854F7A7D9C87566FC281" validation="SHA1"/>
<authorization>
<deny users="?"/>
<allow users="*" />
</authorization>
只要每个系统设置相同就可以了.<forms name=".ASPXAUTH" protection="All" timeout="60" loginUrl="Login.aspx" defaultUrl="Default.aspx" />
</authentication>
<machineKey validationKey="CFAAD85CB1217AA132A01A640D815C5D02A47C72244D75D62AE62B6F3AC31FC26068CC248DB821BC74BA8A22516FF2197823B3C839432A1D588B" decryptionKey="340A3799854F7A7D9C87566FC281" validation="SHA1"/>
<authorization>
<deny users="?"/>
<allow users="*" />
</authorization>
private string KeysOuts(int i)
{
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] bt = new byte[i];
rng.GetBytes(bt);
System.Text.StringBuilder str = new System.Text.StringBuilder();
for (int j = 0; j < i; j++)
{
str.Append(string.Format("{0:X2}", bt[j]));
}
return str.ToString();
}
随机密码生成函数
{
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] bt = new byte[i];
rng.GetBytes(bt);
System.Text.StringBuilder str = new System.Text.StringBuilder();
for (int j = 0; j < i; j++)
{
str.Append(string.Format("{0:X2}", bt[j]));
}
return str.ToString();
}