使用会话检索用户指定信息 [英] Retrieving user specifi information using session

查看:103
本文介绍了使用会话检索用户指定信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我想创建一个简单的网站.当用户登录到
时 网站,他应该只获取用户特定的信息.如何使用会话来检索用户特定的信息?如何将值传递到数据库以访问用户特定的信息?请帮助我...

Hi all,
I would like to create a simple website.As the user log on to the
website he should get the user specific information only.How can I use the session to retrieve the user specific information???How to pass the values to data base for accessing the user specific information???Please help me...

推荐答案

在VB中,
名称空间是相同的.
您可以轻松地转换代码.

这是会议的解决方案:

创建一个名为Employee的类,该类将保存ID,用户名,电子邮件等值.
然后将其存储到会话中,例如:

Hi In VB also,
the namespaces are same.
you can easily convert the code.

Here solution of Session:

Create a Class Named Employee which will hold values like ID, username, email etc.
then store that into session like:

Employee obj;
//Set values into obj
Session["UserInfo"] = obj;

//Code to retrieve from session

if(Session["UserInfo"] != null)
{
    Employee obj = Session["UserInfo"] as Employee;
    //This object contains all the information
}


供URL以下使用数据库

http://csharpcomputing.com/Tutorials/Lesson17.htm [在ASP.Net中浏览会话 [
For Database use below URL

http://csharpcomputing.com/Tutorials/Lesson17.htm[^]

and for Session

Exploring Session in ASP.Net[^]


您好,
您到底想知道什么?
如何在会话中存储数据或如何从数据库检索数据?
Hi aswathy,
What exactly you want to know ?
How to store the data in session or how to retrieve data from DB?


这篇关于使用会话检索用户指定信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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