Home > Archive > ASP .NET > February 2006 > getting currently logged in user asp.net c sharp class
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
getting currently logged in user asp.net c sharp class
|
|
| eswanson 2006-02-28, 7:58 am |
| How do you get the currently logged in user from a regular c sharp class?
I have a common utility class in which I have some static functions that
called from multiple places. In one of the functions, I need to know who is
the username of the user that is currently logged into the website. On the
webpage in the website, I can use either profile.username or
context.username, what is the method for doing this in a regular c sharp
class?
Thanks
Eric
| |
| Peter Bromberg [C# MVP] 2006-02-28, 7:58 am |
| In your "Regular" C# class, provided you have a reference to System.Web, you
can access the HttpContext.Current instance which gives you the same features
and properties you would use in a web page.
Hope that helps.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"eswanson" wrote:
> How do you get the currently logged in user from a regular c sharp class?
>
> I have a common utility class in which I have some static functions that
> called from multiple places. In one of the functions, I need to know who is
> the username of the user that is currently logged into the website. On the
> webpage in the website, I can use either profile.username or
> context.username, what is the method for doing this in a regular c sharp
> class?
>
> Thanks
>
> Eric
|
|
|
|
|