how to get user's Guid id from within BLL

Discussion in 'ASP .Net' started by Jeff, Apr 18, 2009.

  1. Jeff

    Jeff Guest

    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?
     
    Jeff, Apr 18, 2009
    #1
    1. Advertising

  2. Jeff

    sloan Guest

    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

    }


    "Jeff" <> wrote in message
    news:%23%23%23f9f$...
    > 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?
    >
     
    sloan, Apr 18, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?xZ5lbm9sIEFrYnVsYWs=?=

    Static Methods in BLL

    =?Utf-8?B?xZ5lbm9sIEFrYnVsYWs=?=, Mar 18, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,180
    Ersin Gençtürk
    Mar 18, 2005
  2. Replies:
    4
    Views:
    1,366
    sloan
    Jun 15, 2006
  3. Roy

    BLL and DAL.

    Roy, Jun 15, 2006, in forum: ASP .Net
    Replies:
    10
    Views:
    17,651
    =?Utf-8?B?Q2hyaXM=?=
    Jun 16, 2006
  4. Nemisis

    DAL or BLL? How to implement objects

    Nemisis, Oct 3, 2006, in forum: ASP .Net
    Replies:
    22
    Views:
    1,666
    Joerg Jooss
    Oct 17, 2006
  5. Stan SR

    BLL and WebService

    Stan SR, Nov 28, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    454
    Stan SR
    Nov 29, 2006
Loading...

Share This Page