04 2013 档案
摘要:The web.config file exists in the Views folders to prevent access to your views by any means other than your controller. In the MVC design pattern, controllers are supposed to route requests and return a rendered view to the calling client.In other words, your view at www.mydomain.com/MySuperControl
阅读全文
摘要:1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName 获取模块的完整路径。2. System.Environment.CurrentDirectory 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。3. System.IO.Directory.GetCurrentDirectory() 获取应用程序的当前工作目录。这个不一定是程序从中启动的目录啊,有可能程序放在C:\www里,这个函数有可能返回C:\Documents and Settings\ZYB\,或者C:\Program Files\Ad
阅读全文
摘要:在head中加入<style type="text/css"> html{ filter: grayscale(100%); -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><
阅读全文
摘要:在MVC的站点中使用OutputCache实现缓存可以提高页面的打开速度,如:#if !DEBUG [OutputCache(VaryByHeader = "Content-Type", Duration = 600)]#endif public ActionResult Index() { return View(); } 如果每次想要更改缓存时间的话,则需要重新编译,但是可以通过在Web.Config添加配置节点来实现不编译更改缓存配置在<system.web>节点中添加如下配置<caching> ...
阅读全文
摘要:一些网站的页面是通过GZIP技术进行压缩传输的,这样会加快加载速度。但是通过WebClient获取到的html代码则是乱码,所以需要通过GZIP解压来正常显示html代码。byte[] btArrWebHtmlCode = this.GetWebHtmlBytes(url); if (btArrWebHtmlCode.Length == 0) { return string.Empty; } Encoding webEncoding = Encoding.UTF8; ...
阅读全文

浙公网安备 33010602011771号