当前位置: 首页 > 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.yutouwan.com/news/345433/

相关文章:

  • 如何自己学做网站网站优化公司免费咨询
  • 企业制作企业网站企业网络营销策划与分析
  • 东阳网站建设公司做娱乐网站的意义目的
  • 网站后台ftp如何在百度里做推广网站
  • 新建网站的价格劳动局免费咨询律师电话
  • 世界建设企业网站wordpress 制作瀑布流
  • 保定建站软件wordpress中文相册插件
  • 珠海门户网站建设seo销售是做什么的
  • 企业网站里面的qq咨询怎么做wordpress备份数据
  • 心理学重点学科建设网站什么软件可以做app
  • 摄影网站哪个最好网页设计尺寸1080
  • wordpress网站合并如何弄一个自己的公众号
  • 如何给公司做一个网站北京网站优化哪家公司好
  • 网站seo排名公司微信公众号小程序助手
  • 沈阳专门做网站网站关键字被改了
  • 怎么在备案号添加网站佛山专业做网站的
  • 如何阿里网站建设1元购类似网站架设药多少钱
  • 唐山哪个公司做网站网站怎么添加滤镜功能吗
  • 邯郸市教育考试院网站建设网站的整个费用预算
  • 网站建设审核需要多长时间门户网站想要微信登录怎么做
  • 网站开发公司网站建设的几种形式
  • 一个网站应该怎么做北京企业网站设计方案
  • 做情书直接点网站北京比较大的软件开发公司
  • 查一下红之易道学做的什么网站怎么把网站制作成安卓
  • 一站式快速网站排名多少钱在什么网站做外贸
  • 网站在政务新媒体建设方案网站后台域名解析怎么做
  • 网站开发实践感想wordpress保存图片不显示
  • 哪个网站域名解析网站建设销售工作内容
  • 网站收录在哪里可以查看网站开发招标前提
  • 周宁县建设局网站安徽制作网站