ASP.nET记住我的编码 [英] ASP.nET remember me coding

查看:68
本文介绍了ASP.nET记住我的编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何记住我的编码

请详细了解asp.net中的plz帮助信息.

How to Do remember me coding

plz engg m new in asp.net plz helpmeout with detail

推荐答案

在Web应用程序中,记住我,您可以保存用户名& Cookie的密码.在任何一个访问任何页面的情况下,您都可以检查Cookie是否存在任何用户信息.如果有可用的用户信息,则用户已登录.您可以在Global.asax中进行操作.
示例:
In web application, in remember me, you can save the user name & password to the cookie. In any one visit any page, you can check the cookie that there is any user information. If user information available then user is loged in. You can do it in the Global.asax.
Example:
void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started
        if (Request.Cookies["UserCookie"] != null)
        {
            HttpCookie cookie = Request.Cookies["UserCookie"];
            string userEmail = cookie["email"];
            string password = cookie["password"];
            // you can perform your login works
       }
}


这篇关于ASP.nET记住我的编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆