473,399 Members | 3,888 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,399 software developers and data experts.

Create Profile. Going Crazy. Please, help me out.

Hello,

On my CMS I am signed as administrator and I am creating a Membership
user and its profile:

MembershipCreateStatus status;
MembershipUser user = Membership.CreateUser("Joe", "Pass",
"Jo*@email.com", null, null, true, null, out status);
if (user != null) {
ProfileHelper profile =
ProfileHelper.GetProfile(user.UserName);
// Define profile properties values here
profile.Save();
}

ProfileHelper is a custom profile provider that has two properties:
Colaborator and Visitor.

When creating the profile I keep getting the error:
System.Configuration.Provider.ProviderException: This property cannot
be set for anonymous users.

But I am creating another user and I am signed with my account. I am
on this for hours and can't solve this!

Could someone, please, help me? Here is my profile provider:

public class ProfileHelper : ProfileBase {
[SettingsAllowAnonymous(false),
SettingsSerializeAs(SettingsSerializeAs.Binary)]
public Profile.Collaborator Collaborator {
get {
return base["Collaborator"] as Profile.Collaborator;
}
set {
base["Collaborator"] = value;
}
} // Collaborator
[SettingsAllowAnonymous(true),
SettingsSerializeAs(SettingsSerializeAs.Binary)]
public Profile.Visitor Visitor {
get {
return base["Visitor"] as Profile.Visitor;
}
set {
base["Visitor"] = value;
}
} // Visitor

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

// GetProfile
public static ProfileHelper GetProfile(string username) {
return Create(username) as ProfileHelper;
} // GetProfile
}

Thanks,

Miguel

Oct 31 '08 #1
1 2653
On Oct 31, 11:46*pm, shapper <mdmo...@gmail.comwrote:
Hello,

On my CMS I am signed as administrator and I am creating a Membership
user and its profile:

* * * MembershipCreateStatus status;
* * * MembershipUser user = Membership.CreateUser("Joe", "Pass",
"J...@email.com", null, null, true, null, out status);
* * * if (user != null) {
* * * * ProfileHelper profile =
ProfileHelper.GetProfile(user.UserName);
* * * * // Define profile properties values here
* * * * profile.Save();
* * * }

ProfileHelper is a custom profile provider that has two properties:
Colaborator and Visitor.

When creating the profile I keep getting the error:
System.Configuration.Provider.ProviderException: This property cannot
be set for anonymous users.

But I am creating another user and I am signed with my account. I am
on this for hours and can't solve this!

Could someone, please, help me? Here is my profile provider:

* public class ProfileHelper : ProfileBase {
* * [SettingsAllowAnonymous(false),
SettingsSerializeAs(SettingsSerializeAs.Binary)]
* * public Profile.Collaborator Collaborator {
* * * get {
* * * * return base["Collaborator"] as Profile.Collaborator;
* * * }
* * * set {
* * * * base["Collaborator"] = value;
* * * }
* * } // Collaborator
* * [SettingsAllowAnonymous(true),
SettingsSerializeAs(SettingsSerializeAs.Binary)]
* * public Profile.Visitor Visitor {
* * * get {
* * * * return base["Visitor"] as Profile.Visitor;
* * * }
* * * set {
* * * * base["Visitor"] = value;
* * * }
* * } // Visitor

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

* * // GetProfile
* * public static ProfileHelper GetProfile(string username) {
* * * return Create(username) as ProfileHelper;
* * } // GetProfile
* }

Thanks,

Miguel
Please, anyone?
Nov 3 '08 #2

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

Similar topics

2
by: Keith Jakobs, MCP | last post by:
Greetings: I had seen several posts around the Internet about this issue from a few months back, but have been unable to find a resolution ... I have a user who is trying to get started with...
2
by: givlerj | last post by:
I need some help. Here is a little background, I support a MS Access 2k DB (SQL Server 2k backend) that has courses and students. The problem form lets the user pick a course from a drop down and...
0
by: Ron | last post by:
Hi, I need to store a string array in the profile properties. I belive this will work please correct me if wrong. It is only going to hold three items. Thanks, Ron
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
1
by: shapper | last post by:
Hello, I have a profile with multiple profile properties in my Web.Config: <add allowAnonymous="false" name="Contact" type="Contact" serializeAs="Binary"/> <add allowAnonymous="false"...
11
by: Weston Weems | last post by:
I've got the need to have user information for logged in user in a readily avaliable page context (a lot like how Profile is) except not suck. Before we jump to any conclusions, from what I...
2
by: Brandon Holliday | last post by:
Hello, I have a problem that I need some help on. I am creating a website that utilizes the builtin membership functionality in Asp.net 2.0. By default, the "AspNetSqlProvider" is used and...
4
by: Scott M. | last post by:
When profile data is stored in ASP .NET, where is the user data persisted? For how long is it persisted: is it session persisted or permanent (like a cookie)?
6
by: Mr. X. | last post by:
Hello. How can I create aspnetdb from scratch ? (I want a script that create all table, views, etc... on that database). Thanks :)
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.