当前位置: 首页 > news >正文

公司网站备案去哪里备案驻马店建设局网站

公司网站备案去哪里备案,驻马店建设局网站,莆田网站建设方案优化,网络公司排名100名本文章使用asp.net内置membership作为登陆操作 关于配置membership 不用说明了 网上都有的首先建立一个login页面 随便放一个login控件和loginstatus控件aspx代码bodyform idform1 runatserverdivasp:Login IDLo… 本文章使用asp.net内置membership作为登陆操作 关于配置membership 不用说明了 网上都有的首先建立一个login页面 随便放一个login控件和loginstatus控件aspx代码bodyform idform1 runatserverdivasp:Login IDLogin1 runatserver onloggedinLogin1_LoggedIn onlogginginLogin1_LoggingIn/asp:Loginasp:LoginStatus IDLoginStatus1 runatserver onloggingoutLoginStatus1_LoggingOut //div/form /bodycs代码 MembershipUser user;protected void Login1_LoggedIn(object sender, EventArgs e){if(user null)user Membership.GetUser(User.Identity.Name);//获取登陆用户名的membershipuser实例 Guid newguid Guid.NewGuid();//新建guid HttpCookie cookieResponse.Cookies[FormsAuthentication.FormsCookieName];//获取cookie FormsAuthenticationTicket ft FormsAuthentication.Decrypt(cookie.Value);//解密表单票FormsAuthenticationTicket newft new FormsAuthenticationTicket(ft.Version, ft.Name, ft.IssueDate, ft.Expiration, ft.IsPersistent, newguid.ToString(), ft.CookiePath);//重新创建一个表单票 把生成guid加入userdata中user.Comment loginExpiration; ft.Expiration.ToString() |loginSessionID; newguid.ToString();//存储guid数据和过期时间Membership.UpdateUser(user);//更新用户数据Response.Cookies.Remove(FormsAuthentication.FormsCookieName);//删除已有相关formsName的cookieHttpCookie newCookie new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(newft));//重新创建cookienewCookie.Domain cookie.Domain;newCookie.Expires cookie.Expires;newCookie.HttpOnly cookie.HttpOnly;newCookie.Path cookie.Path;newCookie.Secure cookie.Secure;Response.Cookies.Add(newCookie);//输出cookie到客户端 }protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e){if (user null){user Membership.GetUser(Login1.UserName);}//禁止同一个会话再次登陆//禁止同一个会话再次登陆if (user ! null){if (User.Identity.IsAuthenticated user.UserName User.Identity.Name){if (!string.IsNullOrEmpty(user.Comment) user.Comment.Contains(loginExpiration)){string currentExpirationStr user.Comment.Split(|.ToCharArray())[0];DateTime currentExpiration DateTime.Parse(currentExpirationStr.Split(;.ToCharArray())[1]);if (currentExpiration DateTime.Now){e.Cancel true;Literal t Login1.FindControl(FailureText) as Literal;t.Text 你已经登陆了 !;}}}}}protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e){//退出登陆 清空用户的comment数据MembershipUser mu Membership.GetUser();mu.Comment string.Empty;Membership.UpdateUser(mu);}然后 需要一个Httpmodule模块cs代码using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security;namespace aspnetajaxtast {public class FormsAuthsessionModule : IHttpModule{public void Dispose(){}public void Init(HttpApplication context){context.PostAuthorizeRequest new EventHandler(context_PostAuthorizeRequest);}void context_PostAuthorizeRequest(object sender, EventArgs e){HttpApplication app sender as HttpApplication;HttpContext c app.Context;if (c.User.Identity.IsAuthenticated){FormsAuthenticationTicket ft (c.User.Identity as FormsIdentity).Ticket;Guid g;if (ft.UserData ! ){g new Guid(ft.UserData);}elseg Guid.Empty;MembershipUser user Membership.GetUser(c.User.Identity.Name);Guid currentSessionGuid;if (!string.IsNullOrEmpty(user.Comment)){string currentSessionStr user.Comment.Split(|.ToCharArray())[1];currentSessionGuid new Guid(currentSessionStr.Split(;.ToCharArray())[1]);}else{currentSessionGuid Guid.Empty;}if (g ! currentSessionGuid){FormsAuthentication.SignOut();//清空cookie登陆数据 需要重向url//自己自定义转到url的代码 }}}} }web.config 需要配置httpmodule在system.web下httpModulesadd nameFormsAuthsessionModules typeaspnetajaxtast.FormsAuthsessionModule//httpModules这是vs测试或者iis7以下版本需要的如果在iis7 需要以下配置代码system.webServermodules runAllManagedModulesForAllRequeststrue add nameFormsAuthsessionModules typeFormsAuthsessionModule//modules/system.webServer测试需要两个浏览器就可以了 一个ie 一个ff可以当模拟两台电脑 如果你有两台电脑的话 也可以  转载于:https://www.cnblogs.com/wifi/articles/2456516.html
http://www.zqtcl.cn/news/995015/

相关文章:

  • 对网站开发语言的统计网站内容建设包括什么
  • 西安高端网站建设怎样开公司
  • 华为做网站免费签名设计在线生成
  • 网站产品整合推广爱网聊的男人是什么心理
  • 武威市建设厅网站汕头seo外包公司
  • 酒泉网站怎么做seo东莞高明网站设计
  • 沧州网站建设联系电话杭州设计公司logo
  • 网站子站点是什么意思亚马逊国际站官网
  • 影视cms哪个好苏州关键词优化搜索排名
  • 杭州微信网站开发网站优化公司免费咨询
  • 宣武富阳网站建设南昌公众号开发公司
  • 免费的网站推荐下载wordpress %s
  • 网站的原理百度旧版本下载
  • 衡水网站建设地方新网域名证书下载
  • 自己做的创意的网站什么是淘宝seo
  • 网站开发包含哪些网站设计实例
  • 网站建设 核算棋牌源码论坛
  • 杭州网站建设案例网页设计程序
  • 网站建设的相关问题湛江网站开发
  • 网站开发作业wordpress用户角色
  • 品牌网站制作建设微信小程序开发需要什么技术
  • 新网站注册国内食品行业网站开发
  • 太原微商网站建设网站里面的视频功能怎么做的
  • 绿色做环保网站的好处网易企业邮箱登录登录入口
  • 卯兔科技网站建设网站验收时项目建设总结报告
  • 触摸网站手机wordpress建立模板下载
  • 做暧在线观看网站网站建设与管理工资
  • 横岗网站建设无锡网站seo外包
  • 房管局 网站做房查学做网站推广要多久时间
  • 电脑网站开发者模式田园综合体建设网站