Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get anonymous profile

Reply
Thread Tools

Get anonymous profile

 
 
shapper
Guest
Posts: n/a
 
      11-14-2008
Hello,

I am working with an ASP.NET MVC Web Application and I am using the
following custom profile provider:

http://weblogs.asp.net/jgalloway/arc...ile-class.aspx

One of the properties is allowed to anonymous users.

How can I get the profile of an anonymous user? They don't have a
username, right?

I am a little bit lost on this.

Thanks,

Miguel
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      11-14-2008
anonymous profiles are tied to a cookie rather than a login.

-- bruce (sqlwork.com)


"shapper" wrote:

> Hello,
>
> I am working with an ASP.NET MVC Web Application and I am using the
> following custom profile provider:
>
> http://weblogs.asp.net/jgalloway/arc...ile-class.aspx
>
> One of the properties is allowed to anonymous users.
>
> How can I get the profile of an anonymous user? They don't have a
> username, right?
>
> I am a little bit lost on this.
>
> Thanks,
>
> Miguel
>

 
Reply With Quote
 
 
 
 
shapper
Guest
Posts: n/a
 
      11-14-2008
On Nov 14, 4:45*pm, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> anonymous profiles are tied to a cookie rather than a login.
>
> -- bruce (sqlwork.com)


Yes, I know. And the cookie was added. I checked it with Firebug.

So how do I get the profile for an anonymous user?! I am using the
following:

ProfileHelper profile = ProfileHelper.GetProfile();

Where ProfileHelper is my custom profile provider that inherits
ProfileBase and has the following method:

public static ProfileHelper GetProfile() {
return Create(System.Web.Security.Membership.GetUser().Us erName)
as ProfileHelper;
}

I always get the error "Object reference not set to an instance of an
object." on the following code line:
return Create(System.Web.Security.Membership.GetUser().Us erName) as
ProfileHelper;

I don't understand how to solve this. any idea? Thanks ...

Thanks,
Miguel



 
Reply With Quote
 
shapper
Guest
Posts: n/a
 
      11-14-2008
On Nov 14, 5:59*pm, shapper <mdmo...@gmail.com> wrote:
> On Nov 14, 4:45*pm, bruce barker
>
> <brucebar...@discussions.microsoft.com> wrote:
> > anonymous profiles are tied to a cookie rather than a login.

>
> > -- bruce (sqlwork.com)

>
> Yes, I know. And the cookie was added. I checked it with Firebug.
>
> So how do I get the profile for an anonymous user?! I am using the
> following:
>
> * ProfileHelper profile = ProfileHelper.GetProfile();
>
> Where ProfileHelper is my custom profile provider that inherits
> ProfileBase and has the following method:
>
> * public static ProfileHelper GetProfile() {
> * * return Create(System.Web.Security.Membership.GetUser().Us erName)
> as ProfileHelper;
> * }
>
> I always get the error "Object reference not set to an instance of an
> object." on the following code line:
> return Create(System.Web.Security.Membership.GetUser().Us erName) as
> ProfileHelper;
>
> I don't understand how to solve this. any idea? Thanks ...
>
> Thanks,
> Miguel


Hi,

I think I solved it. On my code I replaced:

public static ProfileHelper GetProfile() {
return Create(System.Web.Security.Membership.GetUser().Us erName)
as ProfileHelper;
} // GetProfile

By:

public static ProfileHelper GetProfile() {
return Create(HttpContext.Profile.UserName) as ProfileHelper;
} // GetProfile

Now I get the profile of the current user.

Could someone give me a second opinion on my solution?

Thanks,

Miguel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this a local anonymous class or a member anonymous class Reporter Java 3 05-12-2007 05:23 AM
Profile with Anonymous lifecycle question. ashish ASP .Net 0 11-09-2006 08:20 PM
Anonymous Users and Profile =?Utf-8?B?WUM=?= ASP .Net 2 05-11-2006 06:24 AM
Anonymous profile - how is uniqueidentifier handled? cleanup? VB Programmer ASP .Net 3 02-10-2006 05:57 PM
help with an anonymous array of anonymous hashes noeldamonmiller@gmail.com Perl Misc 1 02-10-2005 01:08 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57