MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

add new profile fields?  (Mono Support )

Viewed 37905 time(s), 13 post(s) 9/26/2010 8:31:26 PMby arielf
arielf

arielf

2/15/2011 12:19:28 PM
Hey there! I have started building a project with the monox platform and am quite impressed with the product. You've done a great job!
I have stumbled upon the issue of creating new profile fields. I have seen monox is built on top of asp.net membership, however, standard user profile customization (via web.config) is not allowed apparently. In the default web.config file the profile section is commented out:

<!-- Does not work with Ajax toolkit
    <profile enabled="true">
        <providers>
          <remove name="AspNetSqlProfileProvider"/>
          <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="MonoX" type="System.Web.Profile.SqlProfileProvider" />
        </providers>
        <properties>
        <add name="Location" allowAnonymous="true" defaultValue="50,300"/>
      </properties>
    </profile>
    -->


Do I add custom columns to the UserProfile table in the DB instead?

Thanks!
This content has not been rated yet. 
0 Reputation 11 Total posts
khorvat

khorvat

9/28/2010 10:21:51 AM
Hi arielf,

as documented an early version of ajax toolkit had some issues with asp.net profile so we commented out that section. Since then we have upgraded the ajax toolkit and made some tests and it seems to work (it is not interfering with ajax toolkit) correctly. The bottom line is that we didn't fully test the profile in combination with new version of ajax toolkit so that's why we didn't uncomment the section.

Can you please try to uncomment the section and run the application.

If any of the problems appear please contact us and we will try to solve the issue.


Regards.
This content has not been rated yet. 
15993 Reputation 2214 Total posts
kpeulic

kpeulic

9/28/2010 10:37:20 AM
Hi khorvat,

I have uncommented the section and it is working fine.

Regards
This content has not been rated yet. 
1849 Reputation 181 Total posts
arielf

arielf

9/28/2010 1:39:24 PM
Thanks a lot for your quick reply khorvat and kpeulic!

I have added a new profile field in the section of the web.config. However, I am not sure how to activate that field in the user profile control when a user edits his/her own profile. I am looking at both UserProfileModule.ascx and EditProfile.ascx but cannot figure out how to map HTML input fields with the new profile property.
Any suggestions? I assume the ORM is not involved here as this is native ASP.NET functionality.

Thanks a lot!
Ariel
This content has not been rated yet. 
0 Reputation 11 Total posts
khorvat

khorvat

9/28/2010 2:43:01 PM
One more thing related to this issue:

Asp.Net compiles the profile to the App_Code.dll which can't be shiped with the MonoX CMS because custom projects needs to have ability of having custom code put in to the Asp.net folder App_Code (which is compile it to the App_Code.dll).

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
arielf

arielf

9/28/2010 2:59:08 PM
Thanks for the details! I still cannot figure out how to add a custom field to the user profile. After adding it to the profile section of the we.config, do I need to recompile the whole project? How do I map the new profile field to input fields in the user profile page?

This content has not been rated yet. 
0 Reputation 11 Total posts
denis

denis

9/28/2010 3:48:24 PM
Hi Ariel,
Profile provider infrastructure went through a series of issues with different types of projects in VS 2005 and 2008. As MonoX v2 was started as a Web Site Project, we initially included a full support for profile providers in it. However, later changes and issues with Web Application Projects (WAP) forced us to abandon this approach. As Kristijan said, there is a little control of where the profile proxy class goes, and it makes deployment of projects rather cumbersome. In addition, there is no support for strongly typed profiles in WAP, which in our opinion almost beats the purpose of using this approach from a developer's point of view.
There are [url=http://murrayon.net/2009/02/aspnet-profile-and-web-application.html]some workarounds[/url], and this is still a convinient way to manipulate profiles for the end users and non-developers, so we are currently working on reintroducing the full profile provider support. In this version you will have to manually change the profile parts to achieve the desired effect. We are using the dedicated DB table for all additional user profile fields at the moment, which is related 1:1 to the aspnet_users table.
This content has not been rated yet. 
7207 Reputation 956 Total posts
khorvat

khorvat

9/28/2010 3:55:01 PM
Ariel,

one other thing to mention is that our best practice is to put all your custom user specific data to separate table and connect it 1:1 with UserProfile or aspnet_Users table. This is a better approach on the long run.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
mat2

mat2

9/28/2010 3:58:28 PM
I am using the approach you just described - it looks more difficult at the beginning, but you get a full control over the data stored in the user's profile, which is something you will use with the default implementation of the profile provider.
Maybe it could be a different story with a custom provider?
This content has not been rated yet. 
0 Reputation 6 Total posts
arielf

arielf

9/28/2010 6:22:50 PM
Thanks for the support! I understand then that ASP.NET profile is not a good approach for the moment. Khorvat, the best practice you mention is clear in terms of the design. But how would implement that in practice? I can create a new table with custom data and set a 1:1 relationship to the UserProfile table, but still where do I add the business logic for those additional fields ? I would need to somehow blend that in within monox standard user profile page...

SOrry if I sound to noob with that, but I am just trying to measure the efforts involved in customizing monox!

Thank you again.

This content has not been rated yet. 
0 Reputation 11 Total posts
1 2