Results 1 to 5 of 5

Thread: [RESOLVED] [2008] User.Identity.Name In MasterPage

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2007
    Location
    Gothenburg - Sweden
    Posts
    149

    Resolved [RESOLVED] [2008] User.Identity.Name In MasterPage

    hello people
    i have a masterPage in my web-application and in that master page and i need to user "User.Identity.name" in that masterpage. the problem is that the masterpage inherits System.Web.UI.MasterPage but in order to use "User.Identity.name" the must Inherits System.Web.UI.Page ... since the file cannot inherits from two diffrenets classes i can't use 'User.Identity.name"...
    what should i do?
    In Love With .NET Framwork and Microsoft
    Learning ASP.NET,ADO.NET And VB.NET
    Becoming a Software Engineer...

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] User.Identity.Name In MasterPage

    HttpContext.Current.User.Identity.Name.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2007
    Location
    Gothenburg - Sweden
    Posts
    149

    Re: [2008] User.Identity.Name In MasterPage

    yes ... thanks... i also tried to create a new object of type System.Web.UI.Page and named it ObjUser... then i used this code:
    vb Code:
    1. Objuser.User.Identity.Name
    this worked also for me... but anyways thanks for the help...
    In Love With .NET Framwork and Microsoft
    Learning ASP.NET,ADO.NET And VB.NET
    Becoming a Software Engineer...

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] User.Identity.Name In MasterPage

    You shouldn't be using that as it's an unnecessary load on the server of creating a new Page object. The HttpContext provides you with everything you need in a page otherwise, server variables, request, response, it's all there.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2007
    Location
    Gothenburg - Sweden
    Posts
    149

    Re: [2008] User.Identity.Name In MasterPage

    i see... i'll use HttpContext provides ... thanks for the advice...
    In Love With .NET Framwork and Microsoft
    Learning ASP.NET,ADO.NET And VB.NET
    Becoming a Software Engineer...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width