It appears that if you don't have any profile properties defined in the web.config file, your profile will always be anonymous. Either use IsAuthenticated as Peter suggested or define at least one profile property in your web.config.
Skrrrg, thank you very much for sharing that little tidbit. I do not know why it worked, but on a default .Net 4.0 Web Page solution, it fixed the IsAnonymous property. So strange...
Desigen
Member
106 Points
28 Posts
Profile.IsAnonymous doesn't work
Aug 14, 2006 06:05 PM|LINK
I have a big problem
There are some pages I want the users who are in my db see them.
I try to do an sign in page and it word fine
But when I wrote this line in the page load event It doesn't work at all
either when the user sign in
If Profile.IsAnonymous = True Then
Response.Redirect ("Start.aspx")
It's allways true ??
Why ??
Thanks
Bye
pkellner
All-Star
24042 Points
3625 Posts
ASPInsiders
Moderator
MVP
Re: Profile.IsAnonymous doesn't work
Aug 14, 2006 08:06 PM|LINK
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
http://peterkellner.net
Microsoft MVP • ASPInsider
lostlander
Contributor
3041 Points
607 Posts
Re: Profile.IsAnonymous doesn't work
Aug 15, 2006 01:04 AM|LINK
Yes, You can do that.
I wanna know where does your problem lies in.
The IsAnonymous property works fine for me.
When the user isn't signed in, it's TRUE;
When the user has signed in, it's FALSE;
Make sure you have logged in and your config is correct !
Desigen
Member
106 Points
28 Posts
Re: Profile.IsAnonymous doesn't work
Aug 15, 2006 07:57 AM|LINK
I test the Value and it's true all the time even when the user sing in it still true
I saw a video about User and Role and Membership in ASP.Net
and it's work fine with me
But when I wrote the code in my project it doesn't work at all.
Thank you
Skrrrg
Member
2 Points
1 Post
Re: Profile.IsAnonymous doesn't work
Sep 09, 2010 07:36 PM|LINK
It appears that if you don't have any profile properties defined in the web.config file, your profile will always be anonymous. Either use IsAuthenticated as Peter suggested or define at least one profile property in your web.config.
xfinrodx
Member
2 Points
1 Post
Re: Profile.IsAnonymous doesn't work
Jul 08, 2012 03:22 AM|LINK
Skrrrg, thank you very much for sharing that little tidbit. I do not know why it worked, but on a default .Net 4.0 Web Page solution, it fixed the IsAnonymous property. So strange...
<profile enabled="true">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
<properties>
<add name="yourmom"/>
</properties>
</profile>