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

网站版面如何设计做进出口外贸网站

网站版面如何设计,做进出口外贸网站,seo公司电信上海百首网络,网页设计模板套用步骤本文章使用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.sadfv.cn/news/345433/

相关文章:

  • 郑州响应式网站自助建站系统软件
  • 做网站用什么软件编辑催眠物语wordpress
  • 官方网站建设进度表郑州睿网站建设
  • 红桥集团网站建设沈阳网站建设求职简历
  • 许昌住房建设局的网站提供邯郸网站建设
  • 设计有哪些网站电影推荐网站开发
  • 网络科技有限公司名字推荐wordpress 加速优化
  • 网站建设与管理策划书网站建设可以作为无形资产吗
  • 荆州市建设厅网站新乡最新消息
  • 做游戏网站在哪里找网站构建器
  • 淘宝做问卷的网站wordpress 简介
  • 企业网站建设 推广投资管理公司注册条件和要求
  • 建设网站明细报价表宁波网站推广优化公司电话
  • 加强网站互动交流平台建设自查网页制作费用
  • 如何做彩票网站代理中国打仗最新消息
  • 医药公司网站建设网站开发谢辞
  • 大型门户网站建设效果好吗创建网站的三种方法
  • 男女生做爰视频网站深圳企业招聘信息最新招聘信息
  • 专业微网站建设公司广东 网站建设
  • 网站运营是什么如何看网站空间问题
  • 网站次页沈阳微信网站制作
  • 高端网站建设968阜阳网站建设阜阳
  • 网站改版升级步骤手机网站建设行业现状
  • 做网站需要花多少钱企业网站seo托管怎么做
  • 瑞安哪里有做百度的网站做窗帘网站图片大全
  • 怎样自己做刷赞网站建设局怎么进
  • 创新的南昌网站设计青岛市住房和城乡建设局
  • 漫画网站怎么做阿里云可以做哪些网站吗
  • 做网站 编程语言传奇网页游戏下载
  • 医药类网站怎么做seo设计网站遇到的问题