仅检索注册用户数据 [英] Retrieving only register user data

查看:70
本文介绍了仅检索注册用户数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是asp.net的新用户.我用用户名(电子邮件)和密码创建了登录表单.我想获取使用会话并使用该用户ID存储在数据库中的那封电子邮件的用户ID,我希望该用户从另一个table.up上载的所有数据.给我会话,并在asp.net中向我发送代码以实现该目的.
紧急

i new for asp.net.I created login form with user name(e-mail) and password. i want to get user id of that email which is store in database using session and using that user id i want all data which uploaded by that user from another table.how can i do that. give me session and also send me code in asp.net to how to do that.
it is urgent

推荐答案

在此,我正在根据供应商和客户提供解决方案,这些人员已由管理员确认

Here I am giving solution based on vendor and customer and those persons are confirmed by admin

DataSet ds = new DataSet();
           DataTable dt = new DataTable();
           CUserRegisTration commObj = new CUserRegisTration();
           BFUserRegistration bfObj = new BFUserRegistration();
           commObj.T1_LoginId = txtLoginId.Text;
           commObj.T1_Password = txtPassword.Text;
           ds = bfObj.DFLoginValidation(commObj);
           dt = ds.Tables[0];
           Session["Customer"] = dt;
           if (dt.Rows.Count >= 1 && (dt.Rows[0]["MemberType"].ToString()) == "BillAdmin")
           {
               Session["UserName"] = "Welcome," + dt.Rows[0]["FirstName"].ToString();
               Session["LoginTime"] = "Logged in at:" + DateTime.Now.ToLocalTime();
               Response.Redirect("Welcome.aspx");
           }
           else if (dt.Rows.Count >= 1 && (dt.Rows[0]["MemberType"].ToString()) == "Customer")
           {
               Session["UserName"] = "Welcome," + dt.Rows[0]["FirstName"].ToString();
               Session["LoginTime"] = "Logged in at:" + DateTime.Now.ToLocalTime();
               Response.Redirect("InventoryManagementSystem.aspx");

           }
           else if (dt.Rows.Count >= 1 && (dt.Rows[0]["MemberType"].ToString()) == "Vendor")
           {
               Session["UserName"] = "Welcome," + dt.Rows[0]["FirstName"].ToString();
               Session["LoginTime"] = "Logged in at:" + DateTime.Now.ToLocalTime();
               Response.Redirect("InventoryManagementSystem.aspx");
           }
           else
           {
               Master.ErrorMessage = "Please enter correct User name and Password.";
           }
       }


按照您的要求进行操作

1.成功登录后,将Username(emailID)分配给会话. (通过发送验证邮件来验证电子邮件ID是一种很好的做法.)

Follow the steps for your requirement

1. Assign Username(emailID) to the session after the successful login. (Its a good practice to verify the Email ID by sending a verification mail.)

Session["UEmail"]= txtUsername.Text.Trim();



注意:您可以在任何页面中检索此会话值,也可以检查登录用户的存在.

2.通过电子邮件ID(在会话中)检索用户的详细信息



Note : You can retrieve this Session Value in any page and also you can check the existence of the login User.

2. Retrieving the Details of the User through Email ID (Which is in Session)

String StrSQL="Select * from [UserDetailsTableName] where EmailID=@EmailID";
//write here code for sending parameters and assingn the value to Dataset of Datatable and do what you want to do with the Data.




谢谢




Thanks


这篇关于仅检索注册用户数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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