how to get user's Guid id from within BLL

J

Jeff

hi

asp.net 2.0

I'm wondering if it's possible to get the Guid id for user from within the
BLL/DAL.. that is other pages than .aspx.cs...

I know I can get the current username from within BLL using this code:
HttpContext.Current.User.Identity.Name;

I ask cause in my code I want the Guid as it's a foreign key in database...
I have a table which is connected to aspnet_users, so when creating a new
record in that table, then I need the foreign key to the aspnet_users
table...

any ideas?
 
S

sloan

You can pass the context down to the BLL if need be.


OR


If you're in the BLL....its "available".

Try this code in your BLL

if ( null == System.Web.HttpContext.Current ) // Add a reference to
System.Web.dll
{ //Non Web Environment
}
else
{ //Web Environment

}
 

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

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top