教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp.net  >  正文 asp.net记住密码实现下次自动登录代码

asp.net记住密码实现下次自动登录代码

发布时间:2016-12-03   编辑:jiaochengji.com
教程集为您提供asp.net记住密码实现下次自动登录代码等资源,欢迎您收藏本站,我们将为您提供最新的asp.net记住密码实现下次自动登录代码资源
分享一篇关于在asp.net记住用户登录实现下次自动登录代码的,有需要的朋友可以参考一下,我们都是利用了cookie来操作,cookie的作用就体现出来了哈。

//这里cookie怎么写,还要加密 

<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy6664')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy6664>

Respone.Cookie.Add(new Cookie("User_Name",(加密)txtUserName.text)); 

public void CheckLogin()  
{  
  先判断是否有Session
  if(Session["User_Name"]==null || Session["User_Name"]=="")
  {
  再判断是否有Cookie
   if(Request.Cookie["User_Name"]!=null &&Request.Cookie["User_Name"]!="")
  {
  Session["User_Name"] = (解密)Request.Cookie["User_Name"];
  }
   else
  {
  //即没Sessoin,又没Cookie 转到登录页
  Response.ReDriect("Login.request...  
HttpWebRequest myRequest =  
(HttpWebRequest)WebRequest.Create("http:www.here.com/login.asp");  
 
myRequest.Method = "POST";  
myRequest.ContentType="application/x-www-form-urlencoded";  
myRequest.ContentLength = data.Length;  
Stream newStream=myRequest.GetRequestStream();  
 
// Send the data.  
newStream.Write(data,0,data.Length);  
newStream.Close();  
 
// Get response  
HttpWebResponse myResponse=(HttpWebResponse)myRequest.GetResponse();  
StreamReader reader = new StreamReader(response.GetResponseStream(),Encoding.Default);  
string content = reader.ReadToEnd();  
Console.WriteLine(content);  

 

您可能感兴趣的文章:
asp.net记住密码实现下次自动登录代码
php利用$_COOKIE实现自动登录程序代码
php实现记住密码自动登录的功能
jquery cookie 与asp.net实现登录记住用户名密码
ssh expect自动登录的脚本
asp.net单点登录实现
asp.net 使用cookie完成记住密码自动登录
取消IE浏览器登陆提示是否记住密码功能
php记住密码 php用cookie实现记住密码的功能
jquery结合cookie实现自动登录的方法分析

[关闭]
~ ~