473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Get anonymous profile

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
Nov 14 '08 #1
3 3192
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
Nov 14 '08 #2
On Nov 14, 4:45*pm, bruce barker
<brucebar...@discussions.microsoft.comwrote:
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

Nov 14 '08 #3
On Nov 14, 5:59*pm, shapper <mdmo...@gmail.comwrote:
On Nov 14, 4:45*pm, bruce barker

<brucebar...@discussions.microsoft.comwrote:
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
Nov 14 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rujuta Gandhi | last post by:
Hi All, I am facing a very crucial problem. Im developing a web application using .net studio 2005(beta). I want my Login.aspx page to be secured(https) for encrypted login information...
2
by: Rodusa | last post by:
I am trying to Synchronize anonymous users with authenticated uses using Profile_MigrateAnonymous. However Profile_MigrateAnonymous only carries information in one direction, for instance, if I...
3
by: VB Programmer | last post by:
ASP.NET 2.0.... The new features ROCK! When using anonymous profile settings.... (using for shopping cart) 1. How does each profile record uniquely identify itself? (Equivalent to a UserId...
3
by: Vincent Ye | last post by:
Hi All, I have an application which is using memship and profile functions. It works well in my develop machine which is using SQL Express Edition Server as the provider. When I move this...
2
by: YC | last post by:
Hi, From the documentation I understood that when an anonymous user uses the profile, the data is saved in a cookie(or part of the URL). I see that It also writes a record to the SQL table(when...
1
by: matt.sickler | last post by:
Does anyone know how to get the UserID of the Anonymous user? The following only returns the UserName, not the UserID HttpContext.Current.Profile.UserName and...
0
by: ashish | last post by:
hi all, I am working with a custom profile provider that stores my business object as profile with anonymous identification turned on. I have a question regarding how it is supposed to work...
3
by: shapper | last post by:
Hello, On my web site I have a property, Visitor, which is available for Anonymous users: public class Visitor { public CultureInfo Culture { get; set; } public List<GuidPolls { get; set;...
2
by: shapper | last post by:
Hello, I am trying to get an anonymous user using the following: MembershipUser user = System.Web.Security.Membership.GetUser(); However, user is null. On my Web.Config I have the following:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.