473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ASP.NET 2.0 Membership Current User

Hi all

I'm wanting to know if its possible to retrieve the current user when
using the 2.0 membership provider. The GUID UserID in Users I am using
as a foreign key in other tables and I need to use it for other database
operations.

The membership class doesn't expose a CurrentUser() method and has Find
methods but not something I can use.

Any ideas?

Regards
Ray
May 5 '06 #1
2 2747
Hello Ray,

The membership class exposes GetUser() not CurrentUser(). You should be able
to use the Membership.GetUser() method to get the current user:

MembershipUser u = Membership.GetUser(HttpContext.Current.User.Identi ty.Name);
if (u != null)
{
// do some work
}
--
brians
http://www.limbertech.com
"Ray Booysen" wrote:
Hi all

I'm wanting to know if its possible to retrieve the current user when
using the 2.0 membership provider. The GUID UserID in Users I am using
as a foreign key in other tables and I need to use it for other database
operations.

The membership class doesn't expose a CurrentUser() method and has Find
methods but not something I can use.

Any ideas?

Regards
Ray

May 5 '06 #2
brians[MCSD] wrote:
Hello Ray,

The membership class exposes GetUser() not CurrentUser(). You should be able
to use the Membership.GetUser() method to get the current user:

MembershipUser u = Membership.GetUser(HttpContext.Current.User.Identi ty.Name);
if (u != null)
{
// do some work
}

Great. Thanks for the help.

Regards
Ray
May 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Sameh Ahmed | last post by:
Hello there IsInrole gives ya the means to check if the current or impersonated user belongs to a specific windows role or group. is there a way to do the same without using ADSI to check if...
2
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the...
9
by: Paul Keegstra | last post by:
Hi, I am currently working on an asp.net 2.0 web site that is a replacement of a classic asp web site. The current web site uses a Commerce Server 2002 database for storing user information. ...
2
by: John | last post by:
OK, I read and read again information on using the logon control, 'custom providers' but none are really helping me out with creating a provider to go against my database to validate the users...
4
by: =?Utf-8?B?Q2hyaXMgQ2Fw?= | last post by:
I have been having some trouble with implementing a custom Membership Provider. We have a custom data store and business logic that pulls user information. I need some level of functionality...
0
by: =?Utf-8?B?QV9SZXB1YmxpY2Fu?= | last post by:
This is a portion of my Web.config file: <system.web> <membership defaultProvider="SqlProvider"> <providers> <clear/> <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider"...
3
by: Glenn | last post by:
My current classic-ASP site has users, projects, roles and the 2.0 membership looks like a perfect fit, but I'm having trouble finding examples of how to have users that belong to different...
4
by: alexandis | last post by:
There are tons of articles about custom role and provider membership, but they just tear me apart and confuse :( The situation is following: I use DB2, so I wrote custom role + membership...
8
by: Nick | last post by:
Hi there, Membership.GetNumberOfUsersOnline() works great the first time, then jumps up to the number of users registered in the system. I have tried enumerating through each user individually...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.