Groups > Application developers > Community Server Source discussions > Re: csContext.Context.Request.IsAuthenticated Always TRUE?




csContext.Context.Request.IsAuthenticated Always TRUE?

csContext.Context.Request.IsAuthenticated Always TRUE?
Thu, 5 Oct 2006 14:59:49 +0000
I have added CS dlls and config files to a current project.  When I add the
following code IsAuthenticated is always true even though it says it is an
anonymous user.  What am I missing.  I searched for fourm be couldn't find
anything useful.

CSContext csContext = CSContext.Current;

        if (!csContext.Context.Request.IsAuthenticated)
        {
            csContext.Context.Response.Redirect(Globals.GetSiteUrls().Login);
            csContext.Context.Response.End();


        }

 

Thanks,
John
Post Reply
Re: csContext.Context.Request.IsAuthenticated Always TRUE?
Thu, 5 Oct 2006 16:25:24 +0000
Please change your Code to following for community Server..

CSContext csContext = CSContext.Current;

        if (!csContext.IsAuthenticated)  
        {
            csContext.Context.Response.Redirect(Globals.GetSiteUrls().Login);
            csContext.Context.Response.End();
        } 


 csContext.IsAuthenticated is a property which internally makes a call to
community Server 's  User Object  , which is NOT  ASP.NET  User object..



For general concept about the behavior of IsAuthenticated Property in Request
Object,  Check this out 
http://www.dotnet247.com/247reference/msgs/22/114539.aspx   


-thank you,
Post Reply
Re: csContext.Context.Request.IsAuthenticated Always TRUE?
Thu, 5 Oct 2006 17:14:35 +0000
Thanks.  I would haven't figured that out for a while.  I'm very new to CS and
just started to learn about Context and Users and whatnot.  Struggling.

 

If you have any advice on creatinging a website based on CS authentication that
would be extremely helpful as well.  Hopefully the article link will do it. 
Thanks Again.
Post Reply
about | contact