getting currently logged in user asp.net c sharp class

G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,829
Latest member
KimberAlli

Latest Threads

Top