摘要: VS2012中对C#的支持度非常好,不管是编写方便程度(不需要插件就能高亮代码及代码自动提示功能),还对MFC的一些功能优化很多。 我们可以修改两个工程文件来把VS2012的工程文件一直到VS2010中去。 首先当然是修改解决方案文件(.sln文件)。 使用记事本打开,把里面的Microsoft V... 阅读全文
posted @ 2014-11-24 20:51 You最温暖的港湾 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 用途:防止CSRF(跨网站请求伪造)。用法:在View->Form表单中:在Controller->Action动作上:[ValidateAntiForgeryToken]原理:1、这个方法会生成一个隐藏域:并且会将一个以"__RequestVerificationToken“为KEY的COOKIE... 阅读全文
posted @ 2014-11-16 20:43 You最温暖的港湾 阅读(1721) 评论(0) 推荐(0) 编辑
摘要: publicstaticstringGetIP(){stringstrUrl="http://www.ip138.com/ip2city.asp";//获得IP的网址了Uriuri=newUri(strUrl);WebRequestwr=WebRequest.Create(uri);Streams=... 阅读全文
posted @ 2014-11-10 10:33 You最温暖的港湾 阅读(557) 评论(0) 推荐(0) 编辑
摘要: 一直在使用js相关的东西,但很少作总结,今天遇到操作js数组的一些问题,对js的数组有了更进一步的认识!1、创建数组var array = new Array();var array = new Array(size);//指定数组的长度var array = new Array(item1,ite... 阅读全文
posted @ 2014-10-24 14:11 You最温暖的港湾 阅读(1148) 评论(0) 推荐(0) 编辑
摘要: 在Asp.net MVC 3 web应用程序中,我们会用到ViewData与ViewBag,对比一下:ViewDataViewBag它是Key/Value字典集合它是dynamic类型对像从Asp.net MVC 1 就有了ASP.NET MVC3 才有基于Asp.net 3.5 framework... 阅读全文
posted @ 2014-10-23 19:57 You最温暖的港湾 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1.提供视图模型对象你能把一个对象作为View方法的参数传递给视图.[csharp] view plaincopyprint?publicViewResultIndex(){DateTimedate=DateTime.Now;returnView(date);}然后我们在视图中使用Razor的Mod... 阅读全文
posted @ 2014-10-23 19:29 You最温暖的港湾 阅读(211) 评论(0) 推荐(0) 编辑
摘要: publicvoidDataReadAndWiteToExcel(){try{BaseBLLbll=newBaseBLL();#region导出数据格式//varlist=bll.GetModelList("IsDelete=0","MSP_GroupUserVideo");varlist=Bind... 阅读全文
posted @ 2014-10-22 15:32 You最温暖的港湾 阅读(331) 评论(0) 推荐(0) 编辑
摘要: //////返回本机的mac物理路径//////privatestringGetMac(){stringmac=null;//[DllImport("System.Management.dll")]ManagementObjectSearcherquery=newManagementObjectSe... 阅读全文
posted @ 2014-10-21 16:32 You最温暖的港湾 阅读(186) 评论(0) 推荐(0) 编辑
摘要: substr返回从指定位置开始的指定长度的子字符串str.substr(star[,length])第二个参数可选,不选的话,截取到最后,如果length为0或者负数,那么返回的将是一个空字符串。star从0开始。substring返回的是指定位置的字符串str.substring(star,end... 阅读全文
posted @ 2014-09-29 21:05 You最温暖的港湾 阅读(694) 评论(0) 推荐(0) 编辑
摘要: privatestringDataTableTojson(DataTabledt){List>list=newList>();foreach(DataRowrowsindt.Rows){Dictionarydict=newDictionary();foreach(DataColumncolindt.... 阅读全文
posted @ 2014-09-29 21:02 You最温暖的港湾 阅读(366) 评论(0) 推荐(0) 编辑