02 2016 档案
摘要:html代码: <input id="file_upload" type="file" /> <div class="image_container"> <img id="preview" style="height:130px;width:117px;border-width:0px;"/> </
阅读全文
摘要:在Model文件夹下添加一个类MyActionFilterAttribute继承于ActionFilterAttribute: using System; using System.Collections.Generic; using System.Linq; using System.Web; u
阅读全文
摘要:MVC4提供的四种基本类型过滤器接口,IAuthorizationFilter、IActionFilter、IResultFilter和IExceptionFilter,可通过继承对应的接口和FilterAttrbute特性,定义自己的过滤器,也可继承内置的过滤器,重写相应的方法,完成自己的需求。
阅读全文
摘要:1. RenderBody在Razor引擎中没有了“母版页”,取而代之的是叫做“布局”的页面(_Layout.cshtml)放在了共享视图文件夹中。在这个页面中,会看到标签里有这样一条语句:@RenderBody()其实它的作用和母版页中的服务器控件类似,当创建基于此布局页面的视图时,视图的内容会和
阅读全文
摘要:建立自己MyViewEngine类让他继承RazorViewEngine,之后在构造函数里面写入设置视图位置格式代码如下: public class MyViewEngine : RazorViewEngine { public MyViewEngine() { ViewLocationFormat
阅读全文
摘要:/// <summary> /// 输出图片 /// </summary> /// <returns></returns> public ActionResult FileContentResultDemo() { //创建一个文件流 FileStream fs = new FileStream(S
阅读全文
摘要:1.建立数据访问层:新建一个项目,选择类库,命名为XXXDAL,然后把新生成的类删除,重新建一个类BaseDal,代码如下: public class BaseDal<T> where T : class,new() { syEntities1 db = new syEntities1(); ///
阅读全文

浙公网安备 33010602011771号