[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?
Re: [2008] User.Identity.Name In MasterPage
HttpContext.Current.User.Identity.Name.
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...
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.
Re: [2008] User.Identity.Name In MasterPage
i see... i'll use HttpContext provides ... thanks for the advice...