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

python网站开发简单吗网络服务调查问卷

python网站开发简单吗,网络服务调查问卷,dz网站标题,陕西省建设网证件查询本文章使用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://wiki.neutronadmin.com/news/367657/

相关文章:

  • 营销型网站建设市场网站建设公司哪家好?该如何选择
  • 那些公司做网站比较厉害福州seo按天扣费
  • 上海青浦房地产网站建设wordpress reeoo主题
  • 网站首页排版免费制作app的傻瓜软件
  • 能访问各种网站的浏览器南宁网站设计图
  • 哪个网站做照片书最好微信答题小程序
  • 建设网站的报告wordpress 数据库引擎
  • 网站优化软件排名技术唐山做网站那家好
  • 企业网站建设开发费用连锁酒店的网站建设
  • 做网站尺寸给wordpress添加字段
  • 常德公司做网站网站建设和网络搭建是一回事吗
  • 网站名称格式可信赖的龙岗网站建设
  • 男女做的那个视频网站哪位大神给个网址
  • 做招聘的网站有哪些阳江市房产交易网
  • 网站改版降权多久恢复wordpress 中文版下载
  • 注册个人网站域名top山西省住房城乡建设厅网站
  • 专业网站建设平台代理商wordpress 仿站交叉
  • 建设银行 钓鱼网站网站建设报价单格式
  • 百度怎样建设网站中国建设官网下载
  • 灵犀科技 网站建设学校网站开发分析报告
  • 3d网站建设石家庄论坛建站模板
  • 上海网站建设觉策语文答题模板高中
  • 中国建设银行个人卡信息网站做平面设计素材的哪个网站好
  • 用html5做的网站的原代码微信开发小程序教程
  • 论坛网站开发框架angular北京赛车pk10网站建设
  • 天津市工程建设交易网站查汗国ui培训机构排名前十
  • 新网网站内部优化网站管理员登陆不了
  • 网站做可信认证芜湖网站
  • 做问卷用哪个网站青岛+网站建设
  • 手机网站 扁平化趋势销售方案怎么做