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. Advertisements

  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. Advertisements

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,318
    Ersin Gençtürk
    Mar 18, 2005
  2. Replies:
    4
    Views:
    1,544
    sloan
    Jun 15, 2006
  3. Roy

    BLL and DAL.

    Roy, Jun 15, 2006, in forum: ASP .Net
    Replies:
    10
    Views:
    18,143
    =?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:
    2,019
    Joerg Jooss
    Oct 17, 2006
  5. Jeff
    Replies:
    2
    Views:
    3,280
  6. Richard Lamboj

    WIN32 - get the GUID of a Network Device

    Richard Lamboj, Apr 26, 2010, in forum: Python
    Replies:
    0
    Views:
    324
    Richard Lamboj
    Apr 26, 2010
  7. Where to get/set a Com Interface Guid IID

    , Apr 3, 2007, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    644
  8. Jonathan Gill

    How To Add User's GUID To An Account Verification E-mail

    Jonathan Gill, Oct 28, 2007, in forum: ASP .Net Security
    Replies:
    4
    Views:
    485
    Jonathan Gill
    Oct 29, 2007
Loading...