开发者

how to run if(!User.IsAuthenticated) or access Profile.values in App_Code? c# .NET

开发者 https://www.devze.com 2022-12-30 21:56 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消