views:

31

answers:

1

i'm trying to run a conditional statement in a class i'm placing in my App_Code folder

the condition is whether the person is logged in or not. I normally have two ways to do this in my masterpage and ASPX's

if (!User.IsAuthenticated) or if(Profile.username = "anonymous")

however neither of these things seem available to me in the .cs i'm making. anyone know what i'm missing? maybe a using namespace up top?

+1  A: 

Change it to HttpContext.Current.User and HttpContext.Current.Profile.

SLaks
the current.user worked like a charm thank you so much but i'm having problems with the profile option, nothing i see in intellisense after HttpContext.Current.Profile. makes any sense. usually Profile.lastlogin is available (that's in the webconfig) but HttpContext.Current.Profile.lastlogin isn't possible.if it's not too much trouble could you tell me what i'm missing there too pleasE? thanks.
korben
You need to cast to the auto-generated strongly-typed Profile class. You can find the name of this class in the IntelliSense tooltip in a designer window.
SLaks
figured it out thanks !
korben