摘要: 我在这篇文章中转载了一个验证码生成的方法:http://www.cnblogs.com/youring2/archive/2013/04/03/2997859.html要在WebPage中使用(MVC也适用),看下面的代码:@{ ValidateCode vCode = new ValidateCode(); string code = vCode.CreateValidateCode(5); Session["ValidateCode"] = code; byte[] bytes = vCode.CreateValidateGraphic(code); Resp... 阅读全文
posted @ 2013-04-03 14:26 拓荒者FF 阅读(846) 评论(1) 推荐(1) 编辑
摘要: 使用C#生成验证码图片,然后在网页中直接使用,很方便的用法。 using System;using System.Drawing;using System.Drawing.Imaging;using System.Web.UI;using System.Drawing.Drawing2D;using System.IO;/// <summary>/// 生成验证码的类/// </summary>... 阅读全文
posted @ 2013-04-03 14:23 拓荒者FF 阅读(7686) 评论(3) 推荐(4) 编辑
摘要: 使用C#来验证一个字符串是否为合法的Email地址: public static bool IsEmail(string email){ String strExp = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"; Regex r = new Regex(strExp); Match m = r.Match(email); ... 阅读全文
posted @ 2013-04-03 14:17 拓荒者FF 阅读(2832) 评论(1) 推荐(0) 编辑
摘要: 在做网站的时候,用到了去除html标签的问题,用正则匹配到html标签,然后replace即可。 public static string ReplaceHtmlTag(string html, int length = 0){ string strText = System.Text.RegularExpressions.Regex.Replace(html, "<[^>]+>", ""... 阅读全文
posted @ 2013-04-03 14:13 拓荒者FF 阅读(27361) 评论(3) 推荐(13) 编辑