asp.net记住密码实现下次自动登录代码
//这里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实现自动登录的方法分析