MVC路由中routes.IgnoreRoute("{resource}.axd/{*pathInfo}") 到底什么意思!

摘要: 我们在开发MVC当中,经常在我们的全局类的路由设置,看到这样的代码:routes.IgnoreRoute("{resource}.axd/{*pathInfo}") //对所有axd的资源 进行忽略,直接进行URL访问几乎有所有的同学 都默认保留,也没有人问津!最近正好,在学习MVC的Filter这个刷选器,顺便在群里发起讨论,几乎没有一个准确答案!我正好借此机会学习了下:{resource}.axd 表示后缀名为.axd所有资源 如webresource.axd{*pathInfo} 表示所有路径这个axd到底是什么呢!从上面可以看到,axd 是对C:\Windows\M 阅读全文
posted @ 2013-02-01 16:10 ~紫鱼~ 阅读(8076) 评论(4) 推荐(1) 编辑

如何正确使用jquery Ajax

摘要: 在我们平时开发当中Jquery AJax 几乎随处可见,但大多数同学都是这样使用:$.get 或$.post ,但我一般不推荐这样使用。因为$.get和$.post 终究是对$.Ajax封装的简单易用的高层实现。我个人一般推荐这样使用:$.ajax({ type: "get",//这里还可以用于Post url: "/Login/Login", data: { userCode: _userCode, passCode: _passCode, code: _code, r: Math.random() * 10 }, //这里发送到服务器的数据 befo 阅读全文
posted @ 2013-01-31 17:47 ~紫鱼~ 阅读(508) 评论(0) 推荐(0) 编辑

什么是强类型和弱类型?

摘要: 大家都知道在C#当中分为:值类型和引用类型 ,其实也就是:栈和堆。 托管在内存的方式不同而已。这里就不深入了。忘了,还有指针类型,这个太深刻,我也不明白 等高手指点中....我们在日常的编程当中老是说强类型编程 不要弱类型编程。但我们使用的C#就是一个强类型语言。但其实C#还是有弱类型的 如:DataTable这个就是典型的弱类型。但我还把Object 也当作弱类型来看待。值类型分为:bool ,byte ,char ,decimal,double,enum,float,int,long,sbyte,short,struct,uint,ulong,ushort引用类型分为:Class,Inte 阅读全文
posted @ 2013-01-30 10:21 ~紫鱼~ 阅读(6213) 评论(3) 推荐(3) 编辑

如何判断可空类型和值得转换!

摘要: 代码如下: public ActionResult Index(int? Key) { //要把KeyValue 转成KeyValue; string KeyValue; return View(); }方案一: public ActionResult Index(int? Key) { //要把KeyValue 转成KeyValue; string KeyValue; KeyValue = (Key ... 阅读全文
posted @ 2013-01-28 16:15 ~紫鱼~ 阅读(293) 评论(0) 推荐(0) 编辑

mvc 做伪静态另外一个方法

摘要: 上一篇文章介绍如何做伪静态如下: routes.MapRoute(//两个参数不带动作 "TwoparameterNoAction", "{controller}/{CurrentID}/{ClassID}.html", new { controller = @"[a-zA-Z]", action = "Index", CurrentID = @"[\d]{0,3}", ClassID =UrlParameter.Optional } );这样就能匹配:http://www.163.com/Ho 阅读全文
posted @ 2013-01-25 09:03 ~紫鱼~ 阅读(3395) 评论(0) 推荐(1) 编辑

MVC 批量上传图片

摘要: <FORM encType="multipart/form-data" method="post" name="abc" action="Test/Upload.html"> <LABEL for=photo>Photo:</LABEL> <INPUT id=files_0 type=file name=files> <INPUT id=files_1 type=file name=files> <INPUT id=files_2 type=file 阅读全文
posted @ 2013-01-24 13:33 ~紫鱼~ 阅读(2196) 评论(1) 推荐(0) 编辑

IIS7.0/7.5 MVC3 实现伪静态

摘要: routes.MapRoute( "Default", "{controller}/{action}.html/{id}", new { controller = "Login", action = "Index", id = UrlParameter.Optional } );按照网上说的,设置下就可以了。但我调试还是报以下错误:HTTP 错误 404.0 - Not Found您要找的资源已被删除、已更名或暂时不可用。不断调试以后,终于在群里一个朋友帮助下,把.net4.0 经典模式改为集成模式... 阅读全文
posted @ 2013-01-23 18:00 ~紫鱼~ 阅读(2633) 评论(1) 推荐(1) 编辑

javascript 正则替换字符的新方法!

摘要: 最近要对大量页面字符进行替换,百度半天,终于在村子dudu 发现一个好方法,代码如下: <script type="text/javascript"> var s; var str='<img src="http://static.cnblogs.com/images/logo_small.gif" alt="" width="142" height="55" /><img src="http://static.cnblogs.com/images 阅读全文
posted @ 2013-01-22 17:17 ~紫鱼~ 阅读(211) 评论(0) 推荐(0) 编辑

ASP常用读取数据2个调用方式

摘要: 作为一名资深的ASP程序员,经常有新入行的同学在改版老网站或老的程序的时候 问我,ASP怎么调用数据,其实调用数据很简单:set rs=conn.execute("select top 15 * from guestbook order by id desc")上面是对象直接执行快速读取,有点像ado.net 中的ExecuteReadersql="select top 10 id,title,author, shijian,hits,img,sortid from news where classid="&request.QueryString 阅读全文
posted @ 2013-01-22 14:07 ~紫鱼~ 阅读(480) 评论(0) 推荐(0) 编辑

我也说 IEnumerable,ICollection,IList,List之间的区别

摘要: 做C#的同学们,都知道,一类只能有一个继承类,但可以实现多个接口。这句话就告诉我们:IEnumerable,ICollection,IList,List区别了首先我看看 IEnumerable:// 摘要: // 公开枚举器,该枚举器支持在指定类型的集合上进行简单迭代。 // // 类型参数: // T: // 要枚举的对象的类型。 [TypeDependency("System.SZArrayHelper")] public interface IEnumerable<out T> : IEnumerable { ... 阅读全文
posted @ 2013-01-22 13:59 ~紫鱼~ 阅读(9690) 评论(8) 推荐(9) 编辑