|
-
May 6th, 2008, 03:56 AM
#1
Thread Starter
Addicted Member
[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...
-
May 6th, 2008, 04:12 AM
#2
Re: [2008] User.Identity.Name In MasterPage
HttpContext.Current.User.Identity.Name.
-
May 6th, 2008, 04:16 AM
#3
Thread Starter
Addicted Member
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:
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...
-
May 6th, 2008, 04:38 AM
#4
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.
-
May 6th, 2008, 04:39 AM
#5
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|