Link to home
Start Free TrialLog in
Avatar of Rouchie
RouchieFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Name 'User' is not declared

I need to refer to User.Identity.Name within a class in the App_Code folder.  When I use User.Identity.Name I get an error saying

Name 'User' is not declared

Can anyone tell me the correct syntax for reading this value?  Thank you.
Avatar of levyuk
levyuk

That is the correct syntax.
Avatar of Rouchie

ASKER

Sorry, then how do I retrieve the value usually returned when my normal pages read this?  The value is set originally using forms authentication in global.asax.
From that point on every page can access user.identity.name no problem, however, within this class I get the error above.  I'm sure I need to do something else to reference it, but aren't sure what...
ASKER CERTIFIED SOLUTION
Avatar of GavinMannion
GavinMannion

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rouchie

ASKER

That's the one!
Thank you!  :-D