MVC 从控制器将数据对象赋值给前端JS对象
@{ Layout = null;} 示例 //将数据对象转换为 JSON 格式,是为了在网页中通过使用JS将数据作为文本进行处理 var data = @Html.Raw(Json.Encode(ViewBag.Data)); for (var i = 0; i < data.length; …… 阅读全文
@{ Layout = null;} 示例 //将数据对象转换为 JSON 格式,是为了在网页中通过使用JS将数据作为文本进行处理 var data = @Html.Raw(Json.Encode(ViewBag.Data)); for (var i = 0; i < data.length; …… 阅读全文
//App_Start-RouteConfig.cs public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); …… 阅读全文
[Route("api/Message/MessageList/")][HttpGet]public HttpResponseMessage MessageList(){ ResponseResult obj = new ResponseResult(); var pageData = Ydt.ExtLib.DataTableHelper.DataTableToList(re …… 阅读全文
using System.Drawing;using System.Drawing.Imaging;using System.Web.Mvc;namespace MVC2017_Sample.Controllers{ public class DefaultController : Controller { public ActionResult Inde …… 阅读全文
using System;using System.IO;namespace ConsoleApp5{ class Program { /* C# 获取当前目录、当前路径、文件全路径、目录、扩展名、文件名称 */ static void Main(string[] args) { ... …… 阅读全文
using Magic.Tool;using System;using System.Web;using System.Web.Mvc;using System.Web.Routing;//MVC中全局错误拦截namespace Magic.Mvc{ public class MvcApplication : System.Web.HttpApplication ... …… 阅读全文
一、 Cache概述 既然缓存中的数据其实是来自数据库的,那么缓存中的数据如何和数据库进行同步呢?一般来说,缓存中应该存放改动不大或者对数据的实时性没有太多要求的数据。这样,我们只需要定期更新缓存就可以了。相反,如果缓存的更新频率过快的话,使用缓存的意义就不是很大了,因此更新缓存的时候需要一次性从数据库中读取大量的数据,过于频繁地更新缓存反而加重了数据库的负担。那么ASP.NET中的C …… 阅读全文
1、下载安装MSDNURLRewriting.msi。 开源代码http://download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi,下载下来后编译一下就可以了。编译后得到URLRewriter.dll和ActionlessForm.dll两 …… 阅读全文