随笔分类 - C#
摘要:本文讲述c#中如何转义双引号。 c#中转义双引号",使用的转义字符仍然是\。 string str = "\"www.itjsxx.com\""; 但是,在c#的逐字字符中,双引号的转义字符不能用\了,会报错,而是用两个双引号""来表示"。 string str1 = @"""www.itjsxx.
阅读全文
摘要:using System; using System.Web.Http.Filters; public class AllowCrossSiteJsonAttribute : ActionFilterAttribute { public override void OnActionExecuted(HttpActionExecutedContext actionExecutedCont...
阅读全文
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace Taoke.filter { public class corsAttribute : ActionFilterAttribute { ...
阅读全文
摘要:public static string EncryptWithMD5(string source) { byte[] sor = Encoding.UTF8.GetBytes(source); MD5 md5 = MD5.Create(); byte[] result = md5.ComputeHash...
阅读全文
摘要:记一次访问http数据接口的爬坑经历,一般访问一个http接口。 无非就是这么几行代码: 可是这次,死话乱码。PostMan下正常的。。在浏览器中直接访问,设置编码为utf-8b也是可以正常显示的。。用c#后台代码测试了各种编码都以无效,告终。。 查看响应头: Content-Encoding gz
阅读全文
摘要://中国天气网的实时天气接口,经测试,实时温度不是室外温度,湿度貌似可以用。 //101200901.html :101200901为地区天气区码(自行baidu) http://www.weather.com.cn/data/sk/101200901.html //一个可用的天气预报接口 http
阅读全文
摘要:string fullPath = @"\WebSite1\Default.aspx"; string filename = System.IO.Path.GetFileName(fullPath);//文件名 “Default.aspx” string extension = System.IO.Path.GetExtension(fullPath);//扩展名 “.aspx” strin...
阅读全文
摘要:http://bbs.csdn.net/topics/390677299
阅读全文
摘要:二、dfdsdfdsf: 11111三、dfsdfsdfds:Regex reg = new Regex(@"\n.*、.{1,}:\s{1,}");匹配 二、xxxxxxx:X、xxxxxxx: 正则验证是字母还是汉字 字母 /^[a-zA-Z]*$/ 汉字 /^[\u4e00-\u9fa5]*$
阅读全文
摘要:public class GC_ModelBindcs : IModelBinder { public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { List model = (List)bin...
阅读全文
摘要:全局过滤器: NO全局过滤器: FilterConfig.cs Jquery:
阅读全文
摘要:客户端代码: 服务端: 客户端调用: Upload_Request("http://localhost:7115/test/index", "d:\\t.rar", "kk");
阅读全文
摘要:不保留 不删注释:
阅读全文
摘要://System.Management;//需要添加引用(系统自带) /// /// 获取cpu编号 /// /// public String GetCpuID() { try { ManagementClass ...
阅读全文
摘要:[DllImport("user32.dll", EntryPoint = "SetWindowPos",CharSet = CharSet.Auto)] static extern bool SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int X, in...
阅读全文
摘要:static void Main(string[] args) { Console.WriteLine("请输入ip"); string ip = Console.ReadLine(); Parallel.For(1, 65535, i => scan(ip, i, 200)); ...
阅读全文
摘要:调c++写的dll时报这个错,解决方案如下: 项目右键属性->项目设计器->生成->平台->把'默认设置(任何 CPU)'改为x86。 因为'任何 CPU'的程序在64位的机器上就会用运行为64位,而64程序是不能加载32位dll的
阅读全文
摘要:使用如下: List<YEWULIANG> list=new List<YEWULIANG> (){ new YEWULIANG {name="1",age=12} , new YEWULIANG {name="1",age=13} , new YEWULIANG {name="2",age=14}
阅读全文
摘要:html代码如: 服务器端读取的常规做法是: string name = Request.Params["txtName"]; asp.net后台代码如: 参考 晓风残月的随笔 http://www.cnblogs.com/Jinglecat/archive/2008/06/01/1211753.h
阅读全文