Because user is a property of the Page class. so in the page, when you are
doing
User.Identity.Name
it's really like doing
me.User.Identity.Name
and since me is an instance of Page, it inherits the User property.
A user control inherits from UserControl, instead of Page, and doesn't have
the property. To access the page's user from the user control do:
Page.User.Identity.Name ...as you can see while User isn't a property of
UserControl, Page is...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:47**********************************@microsof t.com...
Can some one please tell me why I keep getting an error saying user has
not been declared when I add the following to a class usercontrol.
User.Identity.Name
If it is the page class then there is no problem!!!
EG:
Inherits System.Web.UI.Page = OK
Inherits System.Web.UI.UserControl = Doesn't work
Can you sue the page class in a usercontrol??? How do I solve this???
Thanks