
(C#)ASP.NET功能源码
文章平均质量分 74
houxh86
这个作者很懒,什么都没留下…
展开
-
遍历页面所有TextBox控件并给它赋值为string.Empty
foreach (Control control in this.Form.Controls) { if (control is System.Web.UI.WebControls.TextBox) { TextBox txt = (TextBox)control; txt.Text = String.Empty ; }原创 2011-03-13 19:14:00 · 523 阅读 · 0 评论 -
ASP.NET中的简单防盗链功能
文件结构图如下: Default.aspx //此页面只有两个简单的下载链接 下载download.rar 下载readme.txt Default.aspx.cs //因为在此使用的session验证,所以只是在P翻译 2011-10-10 13:55:00 · 661 阅读 · 0 评论 -
在数据库中处理image字段【把图片存储到数据库并显示出来】
方法简介: 保存图片将图片将图片转换成byte[],并得到MIME类注: string mime = FileUpload1.PostedFile.ContentType;//获取MIME类型 byte[] data = F翻译 2011-10-11 15:32:35 · 1555 阅读 · 0 评论 -
C# 生成随即验证码图片类库
using System;using System.Web;using System.Collections.Generic;using System.Text;using System.Drawing.Imaging;using System.Drawing;pu翻译 2011-10-11 17:53:44 · 30024 阅读 · 0 评论 -
生成随即验证码图片
主要步骤为:随机生成字符串,并将字符串保存到Session或者Cookie中将生成字符串绘 制成图片,并设置元素的src为动态生成的图片 //即生成随机验证码图片的页面 生成随机验证码图片代码://可放置在生成验证码图片的页面并执行,即元素的src指向的页面翻译 2011-10-11 17:28:59 · 514 阅读 · 0 评论 -
Unicode编码与字符对应表程序
using System.Text;//引用命名空间//不包括128以前的//0xFFFF 为Unicode最大长度StringBuilder s = new StringBuilder(0xFFFF * 3); for (int i = 128;翻译 2011-03-18 15:15:00 · 283 阅读 · 0 评论 -
substring完美截取HTML字符
<br />public string GetContentSummary(string content, int length, bool StripHTML)<br /> {<br /> if (string.IsNullOrEmpty(content) || length == 0)<br /> return "";<br /> if (StripHTML)<br /> {<br />翻译 2011-03-14 09:10:00 · 389 阅读 · 0 评论 -
生成随机验证码
<br />1.<br />Random random = new Random(); //声明随机类对象<br /> protected void Page_Load(object sender, EventArgs e)<br /> {<br /> if(!IsPostBack)<br /> lblCheckCode.Text = random.Next(1000, 9999).ToString();<br /> }<br />2.<br /翻译 2011-03-14 09:08:00 · 334 阅读 · 0 评论 -
URL参数解码
<br />可自已修改编码方式<br />引入命名空间<br />using System.Collections.Specialized;<br />using System.Text;<br />方法<br /> NameValueCollection gb2312Requests = HttpUtility.ParseQueryString(Request.Url.Query, Encoding.GetEncoding("UTF-8"));<br />string iid = gb2312Reques翻译 2011-03-13 19:15:00 · 268 阅读 · 0 评论 -
.net实现邮件发送代码
<br />using System;<br />using System.Collections.Generic;<br />using System.Web;<br />using System.Web.UI;<br />using System.Web.UI.WebControls;<br />using System.Net.Mail;<br /><br />public partial class _Default : System.Web.UI.Page<br />{<br /> prot翻译 2011-03-13 19:15:00 · 557 阅读 · 0 评论 -
ASP.NET 给图片动态添加文字水印
文件结构图:Default.aspx 这里只是添加了几个图片 下面这张图片不存在显示程序指定的默认图片 WaterMarkHandler.cs using Syste翻译 2011-10-10 13:05:49 · 1681 阅读 · 0 评论