Name 'User' is not declared

Posted on 2006-05-23
Last Modified: 2012-05-05
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.
Question by:Rouchie
    LVL 7

    Expert Comment

    That is the correct syntax.
    LVL 25

    Author Comment

    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 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...
    LVL 15

    Accepted Solution

    You will need

    LVL 25

    Author Comment

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

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now