I am using ASP.NET 4.0 WebApplication project
The following will save user name to my current.profile
System.Web.HttpContext.Current.Profile["UserName"] = userName
I would like to add a new profile named Company with the value ‘MyCompany’ to all users.
It should be somthing like that:
for all users....
{
System.Web.HttpContext["SpecificUser"].Profile["Company"] = "MyCompany"
}
How can i do it?
You cannot access everyone’s HttpContext, however, you could write it to each profile, assuming you know the user’s profile user ID. If you don’t have their user ID’s handy, you may want to write it to the database directly via a stored procedure. The main point is you need to write it to the profile DB in order to share it for all users.