how to run if(!User.IsAuthenticated) or access Profile.values in App_Code? c# .NET
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 w开发者_运维百科ays 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?
Change it to HttpContext.Current.User
and HttpContext.Current.Profile
.
精彩评论