C# 模拟用户登录
摘要://////登录网站并获取Cookies//////成功登录的Cookie信息publicstaticCookieContainerGet_Login(){CookieContainercc=newCookieContainer();stringFormURL=http://www.fy681.com/login.aspx;//处理表单的绝对URL地址stringFormData="username=dahai163&passwd=123";//表单需要提交的参数,注意改为你已注册的信息。ASCIIEncodingencoding=newASCIIEncoding(
阅读全文
posted @
2014-02-21 11:51
万德源
阅读(842)
推荐(0)
图片和二进制的转换
摘要:public Image ReadImage(byte[] bytes){MemoryStream ms=new MemoryStream(bytes,0,bytes.Length);BinaryFormatter bf = new BinaryFormatter();object obj=bf.Deserialize(ms); ms.Close(); return (Image)obj;}/// /// 将Image转换为byte[]/// /// Image/// byte[]public byte[] ConvertImage(Image image){MemoryStream ms..
阅读全文
posted @
2013-10-06 09:13
万德源
阅读(395)
推荐(0)
遍历所有的属性清空字符串的值
摘要:public void ClearData() { System.Reflection.PropertyInfo[] properties = this.GetType().GetProperties(); foreach (System.Reflection.PropertyInfo property in properties) { if (property.PropertyType.FullName=="System.String") property.SetValue(this, "", null); } }
阅读全文
posted @
2013-09-12 11:29
万德源
阅读(338)
推荐(0)
网易ip api
摘要:http://www.youdao.com/smartresult-xml/search.s?type=ip&q=115.156.238.1
阅读全文
posted @
2013-07-28 09:49
万德源
阅读(176)
推荐(0)
vs 点击就设置项目为默认启动项
摘要:装好系统没注意做项目的时候解决方案比较多发现点击哪个项目哪个项目就成了默认启动项目这个开始没觉出来 最后发现挺烦人的想想难道是我装vs装的么 我于是卸载了全新安装了 还是一个吊样无意间试了下 右键设置为默认启动项目 擦 居然好了 不自己给我改默认启动项目了
阅读全文
posted @
2013-07-24 10:10
万德源
阅读(3337)
推荐(0)
从客户端(MuliteTextBox2="<a href="http://www....")中检测到有潜在危险的 Request.Form 值
摘要:由于在.net中,Request时出现有HTML或Javascript等字符串时,系统会认为是危险性值。立马报出“从客户端 中检测到有潜在危险的Request.Form值”这样的错。 解决方案一: 在.aspx文件头中加入这句: eg:解决方案二: 修改web.config文件: 因为validateRequest默认值为true。只要设为false即可。
阅读全文
posted @
2013-07-20 21:19
万德源
阅读(1289)
推荐(0)
检查输入的字符值 时候符合正则表达式规则
摘要:public bool CheckInputString(string regexText, string inputText) { Regex regex = new Regex(regexText, RegexOptions.IgnoreCase | RegexOptions.Compiled); return regex.IsMatch(inputText);}
阅读全文
posted @
2013-07-19 14:13
万德源
阅读(348)
推荐(0)
小数的正则 和解释
摘要:小数点正则^\\d*(\\.\\d+)?$^正则的开始$正则结束\d* 表示一个或多个0-9的数字(\.\d+)? 表示小数后面可有可无 里面的格式是 一个点和后面一个多多个数字
阅读全文
posted @
2013-07-19 11:23
万德源
阅读(888)
推荐(0)
ASP.NET 优化管道 缓存设置 静态页面设置缓存
摘要:Asp.NET有许多秘密,当你了解了这些秘密后,可以使得你的ASP.NET应用程序达到极大的性能提升。举例来说,在使用Membership和profile进行Authentication和authorization时,可以通过简单的修改Membership和profile以提高Authenticat...
阅读全文
posted @
2012-11-07 10:28
万德源
阅读(2171)
推荐(0)
判断checkboxlist 是否选中的js函数
摘要:判断checkboxlist 是否选中的js函数
阅读全文
posted @
2012-07-27 11:06
万德源
阅读(972)
推荐(0)
asp:CustomValidator自定义验证控件的使用例子
摘要:function compareError(sender, args) { var dateStart = $("#<%=txtStartTime.ClientID %>").val().replace(/\-/g, "\/"); var dateEnd = $("#<%=txtEndTime.ClientID %>").val().replace(/\-/g, "\/"); if (dateStart.length > 0 && dateEnd.length >
阅读全文
posted @
2012-07-26 15:20
万德源
阅读(342)
推荐(0)
显示路径下图片
摘要:System.Drawing.Image image = System.Drawing.Image.FromFile("G:\\zt_tg.jpg"); using (Bitmap bmp = new Bitmap(image.Width, image.Height)) { // 绘制验证码文本 using (Graphics g = Graphics.FromImage(bmp)) { g.DrawImage(image, 0, 0, image.Width, image.Height); System.IO.MemoryStream ms = new System.IO
阅读全文
posted @
2012-07-12 14:24
万德源
阅读(210)
推荐(0)
读取excel 可以多个模板同一连接遍历
摘要:public DataTable ExcelToDataSet(string filename, string[] templateNames) { DataTable dataTable = new DataTable(); string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Extended Properties=Excel 8.0;" + "data source=" + filename; OleDbConnection myConn = new OleDbConnec
阅读全文
posted @
2012-06-21 13:46
万德源
阅读(440)
推荐(0)
C# json 序列化 扩展类
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Runtime.Serialization.Json;using System.IO;using System.Text;/// <summary> /// JSON序列化和反序列化辅助类 /// </summary> public static class JsonHelper{ /// <summary> /// JSON序列化 /// </summary>
阅读全文
posted @
2012-06-01 17:43
万德源
阅读(808)
推荐(1)
递归选中treeview 树节点的值
摘要:/// <summary> /// 选中treeview的某个节点,需要每个node的value不同 /// </summary> /// <param name="sNodeValue"></param> private void selectNode(TreeNodeCollection tns, string sNodeValue) { foreach (TreeNode tRoot in tns) { if (tRoot.Value == sNodeValue) { tRoot.Checked=true; return
阅读全文
posted @
2012-05-30 14:11
万德源
阅读(276)
推荐(0)
asp.net form 验证 和取值
摘要:FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, "ticketName", DateTime.Now, DateTime.Now.AddMinutes(60), false, "{UserNAme:'sanmao'}" ); string token = FormsAuthentication.Encrypt(ticket); HttpCookie userCookie = new HttpCookie(FormsAuthentication.For
阅读全文
posted @
2012-05-18 16:53
万德源
阅读(390)
推荐(0)
滚动 Div 例子代码
摘要:<style type="text/css"> .scroll { width: 300px; /*宽度*/ height: 200px; /*高度*/ color: red; /*颜色*/ font-family: 楷体; /*字体*/ padding-left: 10px; /*层内左边距*/ padding-right: 10px; /*层内右边距*/ padding-top: 10px; /*层内上边距*/ padding-bottom: 10px; /*层内下边距*/...
阅读全文
posted @
2012-05-15 11:39
万德源
阅读(187)
推荐(0)
List作为GridView数据源时,绑定模板列的例子
摘要:List作为GridView数据源时,绑定模板列的例子 (2011-11-13 16:38:12)转载▼ 标签: gridview ...
阅读全文
posted @
2012-05-10 18:17
万德源
阅读(6112)
推荐(1)
此时无足够的可用内存,无法满足操作的预期要求,可能是由于虚拟地址随便造成的。请稍候重试。 jm vs咋还会有这个问题
摘要:问题原因:微软的软件的bug问题解决:打微软软件补丁补丁地址:https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=29729
阅读全文
posted @
2012-05-09 10:09
万德源
阅读(272)
推荐(0)