Asp.net源码专业站
首页->尚未分类->Ftp在线注册管理系统源码>>App-Code/Word.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Ftp在线注册管理系统源码
当前文件:文件类型 WebFtp/App_Code/Word.cs[4K,2009-6-12 11:58:24]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Web; 5using System.Web.Security; 6using System.Web.UI; 7using System.Web.UI.WebControls; 8using System.Web.UI.WebControls.WebParts; 9using System.Web.UI.HtmlControls; 10using System.Text; 11using System.Text.RegularExpressions; 12using System.Collections.Generic; 13using System.Security.Cryptography; 14namespace Webftp 15{ 16 /// <summary> 17 /// word 的摘要说明 18 /// </summary> 19 public class Word 20 { 21 private static Regex RegEmail = new Regex("^[\\w-]+@[\\w-]+\\.(com|net|org|edu|mil|tv|biz|info)$");//w 英文字母或数字的字符串,和 [a-zA-Z0-9] 语法一样 22 private static Regex RegCHZN = new Regex("[\u4e00-\u9fa5]");//检测是否有中文字符 23 private static Regex RegUsername = new Regex(@"^[A-Za-z0-9]+$");//检测是否英文字母或数字 24 public Word() 25 { 26 // 27 // TODO: 在此处添加构造函数逻辑 28 // 29 } 30 /// <summary> 31 /// 检查字符串是否超过指定的最大长度 32 /// </summary> 33 /// <param name="sqlInput">输入字符串</param> 34 /// <param name="maxLength">最大长度</param> 35 /// <returns></returns> 36 public static bool StrLength(string StrInput) 37 { 38 if (StrInput.Length > 8) 39 { 40 return false;//超过8个字符,返回假 41 } 42 else 43 { 44 return true; 45 } 46 } 47 /// <summary> 48 /// 检测是否有中文字符 49 /// </summary> 50 /// <param name="StrInput"></param> 51 /// <returns></returns> 52 public static bool IsZh(string StrInput) 53 { 54 Match m = RegCHZN.Match(StrInput); 55 return m.Success; 56 } 57 /// <summary> 58 /// 检测是否英文字母或数字 59 /// </summary> 60 /// <param name="StrInput"></param> 61 /// <returns></returns> 62 public static bool IsEnNum(string StrInput) 63 { 64 Match m = RegUsername.Match(StrInput); 65 return m.Success; 66 } 67 68 /// <summary> 69 /// MD5加密处理 70 /// </summary> 71 /// <param name="toHash"></param> 72 /// <returns></returns> 73 public static string Hash(string toHash) 74 { 75 MD5CryptoServiceProvider crypto = new MD5CryptoServiceProvider(); 76 byte[] bytes = Encoding.UTF7.GetBytes(toHash); 77 bytes = crypto.ComputeHash(bytes); 78 StringBuilder sb = new StringBuilder(); 79 foreach (byte num in bytes) 80 { 81 sb.AppendFormat("{0:x2}", num); 82 } 83 return sb.ToString(); 84 } 85 /// <summary> 86 /// 根据配置对指定字符串进行 MD5 加密 87 /// </summary> 88 /// <param name="s"></param> 89 /// <returns></returns> 90 public static string GetMD5(string s) 91 { 92 //md5加密 93 s = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s, "md5").ToString(); 94 95 return s.ToLower(); 96 } 97 98 /// <summary> 99 /// 转换成小写 100 /// </summary> 101 /// <param name="str"></param> 102 /// <returns></returns> 103 public static string StrToLower(string str) 104 { 105 return str.ToLower(); 106 } 107 108 public static string Serv_u_Md5(string pwd) 109 { 110 string rdoms = ""; //定义字符串 111 Random ran = new Random(); 112 rdoms += Convert.ToChar(ran.Next(26) + 'a').ToString() + Convert.ToChar(ran.Next(26) + 'a').ToString(); //将随机产生的两个字母相连.例如:a+b=ab 113 string strmd5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(rdoms + pwd, "MD5"); //把两位随机字母和md5连接并再次进行MD5加密 114 return rdoms + strmd5; //将两位随机字母与加密后的MD5值再次连接 115 116 } 117 } 118}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Ftp在线注册管理系统源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146