随笔分类 - C# .Net
摘要:string notifyUrl = data["notifyurl"].ToString(); CancellationTokenSource tokenSource = new CancellationTokenSource(); //启用线程,得到回应"SUCCESS",中断线程,没有回应,连续发送5次信息 var t = System.Threading.Tasks.Task.Run(...
阅读全文
摘要:void CreateUrlQRCodeIMG() { Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetMaxAge(TimeSpan.FromSeconds(600000)); Response.ContentType = "i...
阅读全文
摘要:void GetCheckCode() { string code = Encrypt.CreateRandomCode(4); //验证码的字符为4个 Response.ContentType = "image/jpg";//没有这个会出现乱码 Response.BinaryWrite(Encrypt.CreateValidate...
阅读全文
摘要:1.SqlServer 10进制转换成62进制,写成函数方法 2.C# 10进制转换成62进制
阅读全文
摘要://获取存储的缓存 var cacheObject = HttpContext.Current.Cache.Get(cacheKey); //插入缓存设置过期时间为30分钟 HttpContext.Current.Cache.Insert(cacheKey, result, null, DateTi
阅读全文
摘要:<!--新浪微博社区登陆接口--> <add key="SinaWeibo.AppKey" value="*******"/> <add key="SinaWeibo.AppSercet" value="*******"/> <add key="SinaWeibo.CallbackUrl" valu
阅读全文
摘要:public static string UserMd5(string str) { string cl = str; string pwd = ""; MD5 md5 = MD5.Create();//实例化一个md5对像 // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等
阅读全文
摘要:1.引用Newtonsoft.Json.dll 2.用API /// <summary> /// 判断是不是节假日,节假日返回true /// </summary> /// <param name="date">日期格式:yyyyMMdd</param> /// <returns></returns
阅读全文
摘要:int i=10;方法1:Console.WriteLine(i.ToString("D5"));方法2:Console.WriteLine(i.ToString().PadLeft(5,'0'));//推荐方法3:Console.WriteLine(i.ToString("00000")); 在
阅读全文
摘要:string[] elements = new string[50]; if (Array.IndexOf<string>(elements, "a" ) != -1 ) { //存在 //返回的值就是 "a" 在数组中的下标 } else { //不存在 }
阅读全文