views:

60

answers:

1

I have a class library (lets call it a) which i've created a custom profile provider in. I reference this library in another class library (lets call this b) which is part of a solution along with a web application. Now how do i reference the custom profile provider in class library b.

I've been following this article http://leedumond.com/blog/getting-strongly-typed-profile-properties-from-a-class-library. Which is ok but it doesn't save the profile it only reads it.

Has anyone done this or know how to do it?

A: 

Well the example is not really what you're looking for.

Once you have created a ProfileCommon that inherits ProfileBase use an instance of that class to manage it.

so :

ProfileCommon profile = (ProfileCommon)HttpContext.Current.Profile;
profile.Name = "balstedfury";
Profile.Save();

Since ProfileCommon inherits ProfileBase you can call Save that belogs to it. see http://msdn.microsoft.com/en-us/library/system.web.profile.profilebase_members.aspx

Let me know it this helps.

pre63
ProfileCommon is created on the fly isn't it? And being in a class library you have no access to it.
blastedfury
actually ProfileCommon can be instantiated since it's public. For that you need to reference in your application the library. The case where it's created on the fly it is if you use the config only, not your case I believe. But you will need to tel your profile configuration wht is the type of it's profile. If I recall correctly it's an attribute of the profile element.
pre63