06 2015 档案
摘要:一、使用MVC中的Filter来对Session进行验证(1)方法1:public class MyAuthorizeAttribute : FilterAttribute, IAuthorizationFilter{ public void OnAuthorization(Authori...
阅读全文
摘要:最近在ASP.NET MVC项目中碰到这样的情况:在一个controller中设置了Session,但在另一个controller的构造函数中无法获取该Session,会报"System.NullReferenceException"错误。之所以这样做是因为希望在controller构造函数中获取S...
阅读全文
摘要:解决方式:sp_change_users_login 'update_one', '123456', '123456'update_one是存储过程的参数,表示只处理一个用户,前一个“123456”是“用户”,后一个“123456”是“登录”,以上这个SQL表示将服务器登录“123456”与Demo...
阅读全文
摘要://新方法 entity framework 时间操作 query.Where(c => System.Data.Entity.DbFunctions.DiffDays(DateTime.Now, c.AddTime) == 0).Count();//比较天数 //当天用户//方法已经过时 var useractiveentity = db.UserActive.Where(u => u.Us...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Security.Cryptography;using System.Web;namespace GiftWeb.Util{ public ...
阅读全文
摘要://url加密与解密string res1 = HttpUtility.UrlEncode("7Z2K5Lgk/iI=");//值是7Z2K5Lgk%2fiI%3dstring res2 = HttpUtility.UrlEncode(res1);//值是: 7Z2K5Lgk%252fiI%253d...
阅读全文