与ASP.Net成员资格提供使用会话变量 [英] Using session variable with ASP.Net membership provider

查看:159
本文介绍了与ASP.Net成员资格提供使用会话变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我米使用Asp.net成员资格提供与我的Web应用程序!

I m using the Asp.net membership provider with my web application !

我想知道如何获得用户ID和如何以及在哪里可以添加code的应用程序设置相同的会话变量在用户登录!
这是该方案:
用户登录,
我抓住他的ID的数据库
我执行一些查询来设置数据相同的会话变量与该用户的关系:从其他表与用户表关系,如姓名和其他的东西!
根据用户数据(角色和其他的东西),我把它重定向到他自己的观点或页面。

I would like to know how to get the user ID and How and Where can I add code to the application to set same session variable On the User log on ! This is the scenario : The user Logon, I catch his ID an the database I execute some query to set same session variable with data in relation with this user : Like name and other stuff from other table in relation with the user table ! According to user data(role and other stuff), I redirects it to his own view or page.

感谢您对我的帮助!

PS:该会员系统正在使用自己的数据库:的ASPNETDB.mdf!
PSS:我为使用C锋利

PS :The membership system are using his own database : ASPNETDB.mdf ! PSS: I m using C sharp !

推荐答案

Membership.GetUser()。ProviderUserKey 是你在找什么。你为什么想将其存储在会话?

Membership.GetUser().ProviderUserKey is what you're looking for. Why do you want to store it in Session?

这篇关于与ASP.Net成员资格提供使用会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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