?? validatecode.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
/// <summary>
/// ValidateCode 的摘要說明
/// </summary>
public class ValidateCode
{
public ValidateCode()
{
}
public string validateCode()
{
byte[] bytes = new byte[100];
Random randObj = new Random();
int code;
for (int i = 0; i < 4; i++)
{
code = randObj.Next(44, 122);
bytes[i] = Convert.ToByte(code);
}
ASCIIEncoding ascii = new ASCIIEncoding();
string validateCode = ascii.GetString(bytes,0,4);
return validateCode.ToString();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -