摘要:
Ajax在Web应用中的作用越来越大,许多工具都包含了对这一功能的使用,以下是对这些常用工具中Ajax的典型实例.一、jQuery中Ajax的调用(需要引用jQuery代码库)。 1.$.get(url, function(data) { //deal with the data }); 2.jQuery.post( url, [ data ], [ success(data, textStatus, jqXHR) ], [ dataType ] ) $.post(url,postdata, function(data) { //deal with the data }); 3.$.ajax( 阅读全文
摘要:
步骤:1. 登录时手动设置FormsAuthenticationTicket,代码如下:// 可手动添加FormsAuthenticationTicketFormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, "username", DateTime.Now, DateTime.Now.AddMinutes(20), false, "admin");// 加密string HashTicket = FormsAuthentication.Encrypt(Ticket);// 阅读全文
摘要:
在MVC系统开发中,难免会遇到权限验证问题,解决这个问题的方法很多,这里使用自定义AuthorizeAttribute来实现,代码如下: public class MyAuthorizeAttribute : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase httpContext) { if (httpContext.Request.Cookies["yourset"] == null) return false; return base.AuthorizeCore(htt 阅读全文
摘要:
配置项描述:<authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="login.aspx" defaultUrl="default.aspx" protection="All" timeout="30" path="/" requireSSL="false" slidingExpiration="false" enableCro 阅读全文