Hi, I'mimplementingaformtoregistera useron the portalumbraco. Icreated aUserControlusingVisual Studio2008.Iused theCreateUserWizardtoasp.netandwrotethispiece of code.
code-behind: c#
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { /* User is created and setting extra parameters to profile */ TextBox UserNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"); string username = UserNameTextBox.Text; MembershipUser User = Membership.GetUser(username); umbraco.cms.businesslogic.member.Member member = new umbraco.cms.businesslogic.member.Member((int)User.ProviderUserKey); /* Here you can access properties for the member */ umbraco.cms.businesslogic.property.Property FullNameProperty = member.getProperty("fullname"); // Property alias TextBox FullNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("FullName"); FullNameProperty.Value = FullNameTextBox.Text; Roles.AddUserToRole(CreateUserWizard1.UserName, "NuneatonMember"); }
I want to knowwhere I findthe dll directive to use
umbraco.cms.businesslogic.member.Member
In addition, thedataentered in the formasthey aremanaged?Whatisthetableonwhicharestored?I have toset theparameterspassedintoumbracoweb.config? Many thanks Regards. G.
I mean, after you import the UserControl in umbraco and have it appear correctly in the template, how do I manage the connection to the database and how to write the user's entry in the database? I need to change the web.config? Have you ever done something like that? I explained?
Well, I'm not sure why you want to connect to the database since you seem to be creating a member in the member section of Umbraco with the above code. Umbraco is based on the standard ASP.NET membership provider so I guess the above code should take care of creating the members in the member section or am I mistaken? :-)
as you've not changed anything to web.config, you'll be using the standard umbraco membership provider (which is an implementation of the asp.net membership provider), meaning your members will be stored in umbraco's database, more specifically in two different tables. Part of the member data is stored in cmsMember table whereas most of the 'custom' properties are stored in the cmsPropertyData table.
Don't need to manage a connection to the db if using the umbraco membership provider, it's taken care of for you (umbraco membership provider uses the value specified in web.config's umbracoDbDSN appsettings)
Of course, you still have the option of changing some of the properties for the membership provider, and umbraco even has a few more... All settings can be found in the web.config.
No member with loginname: giacomo.cosenza Exists
0,0217720408599417
0,000636
No member with loginname: Exists
0,0229680029165718
0,001196
Unhandled Execution Error
Object reference not set to an instance of an object. at
umbraco.cms.businesslogic.Content.CreateContent(ContentType ct) at
umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String LoginName,
String Email, MemberType mbt, User u) at
umbraco.cms.businesslogic.member.Member.MakeNew(String Name, String Email,
MemberType mbt, User u) at
umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username,
String password, String email, String passwordQuestion, String passwordAnswer,
Boolean isApproved, Object providerUserKey, MembershipCreateStatus&
status) at
System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() at
System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs
e) at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source,
EventArgs e) at System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args) at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I riceved this error after I insert the user data. Why?
I imported the *.dll files and i compiled the source correctly. But after I imported the user control I give this error.
I think this error occurs because you need to define a MemberType in your Umbraco back-end, and refer it in your UmbracoMembershipProvider definition in the web.config.
My guess is that your are either missing the "defaultMemberTypeAlias" attribute in the membership provider definition, or you have not actually created the MemberType "MyDefaultMemberTypeAlias" in the Membership section of the Umbraco backend.
Your C# code looks ok at first look, but since the error occurs in the CreateNew method, I don't think that the code gets to your event handler: it crashes before that, at the moment of creating the member.
From your previous post, I am not sure if you have checked whether you had a MemberType with alias "_umbracoSystemDefaultProtectType" in your backend. Is it the case? And if it is, do you have a property defined in that MemberType for each the "umbraco...TypeAlias" you mention in your web.config?
The user that I insert in the form is added to the member of umbraco :)
But
After I click "create user" raises an exception :
Object reference not set to an instance of an object. Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code. Exception Details:
System.NullReferenceException: Object reference not set to an instance of an
object.
I commented the default part of web.config and I insert the piece of web.config above. In this way I can not logged into umbraco with the credentials
For logged I intended the login in the portal by the control :
Create User Form Registration
Hi,
I'm implementing a form to register a user on the portal umbraco.
I created a UserControl using Visual Studio 2008. I used the CreateUserWizard toasp. net and wrote this piece of code.
code-behind: c#
user Control:
I want to know where I find the dll directive to use
umbraco.cms.businesslogic.member.Member
In addition, the data entered in the form as they are managed? What is the table onwhich are stored? I have to set the parameters passed into umbraco web.config?
Many thanks
Regards.
G.
Hi Giacomo
You need to reference cms.dll, umbraco.dll and businesslogic.dll, which you will find in the bin folder of Umbraco.
I'm not sure what you mean by your last question? Could you ellaborate a bit more?
/Jan
Thanks for the reply,Jan.
I mean, after you import the UserControl in umbraco and have it appear correctly in the template, how do I manage the connection to the database and how to write the user's entry in the database? I need to change the web.config? Have you ever done something like that? I explained?
Thanks.
G.
Hi G
Well, I'm not sure why you want to connect to the database since you seem to be creating a member in the member section of Umbraco with the above code. Umbraco is based on the standard ASP.NET membership provider so I guess the above code should take care of creating the members in the member section or am I mistaken? :-)
/Jan
as you've not changed anything to web.config, you'll be using the standard umbraco membership provider (which is an implementation of the asp.net membership provider), meaning your members will be stored in umbraco's database, more specifically in two different tables. Part of the member data is stored in cmsMember table whereas most of the 'custom' properties are stored in the cmsPropertyData table.
Don't need to manage a connection to the db if using the umbraco membership provider, it's taken care of for you (umbraco membership provider uses the value specified in web.config's umbracoDbDSN appsettings)
Of course, you still have the option of changing some of the properties for the membership provider, and umbraco even has a few more... All settings can be found in the web.config.
Here's a nice overview of the different settings: http://our.umbraco.org/wiki/how-tos/membership-providers/umbracomembershipprovider-properties
Cheers,
/Dirk
I riceved this error after I insert the user data. Why?
I imported the *.dll files and i compiled the source correctly. But after I imported the user control I give this error.
Any Ideas?
Thanks
G.
Hi Giacomo,
I think this error occurs because you need to define a MemberType in your Umbraco back-end, and refer it in your UmbracoMembershipProvider definition in the web.config.
You can find more info about this at this wiki, page : http://our.umbraco.org/wiki/how-tos/membership-providers/umbracomembershipprovider-properties
Basically, your web.config definition will look something like this:
My guess is that your are either missing the "defaultMemberTypeAlias" attribute in the membership provider definition, or you have not actually created the MemberType "MyDefaultMemberTypeAlias" in the Membership section of the Umbraco backend.
Hope this helps.
Cheers,
Michael.
Nothing. But the C# code above is correct? Or should I change anything?
My web.config is:
Hi Giacomo,
Your C# code looks ok at first look, but since the error occurs in the CreateNew method, I don't think that the code gets to your event handler: it crashes before that, at the moment of creating the member.
From your previous post, I am not sure if you have checked whether you had a MemberType with alias "_umbracoSystemDefaultProtectType" in your backend. Is it the case? And if it is, do you have a property defined in that MemberType for each the "umbraco...TypeAlias" you mention in your web.config?
Cheers,
Michael.
Hi guys,
The user that I insert in the form is added to the member of umbraco :)
But
Now, if I comment this part of web.config
and leave this part:
I can create an user, but I can't login in.
Viceversa, i can login with creadentials of users that I added, but i can't register others users.
Why?
Any Ideas?
Thanks.
G.
Hi Giacomo Cosenza,
Did you get this working..
iam working on the registration form my website.. iam not getiing the proper solution some bits works fine..
can you please provide the information will be great.
Hi adarsh,
what is the problem? What do you done so far?
Give me some information about your work.
thanks.
Giacomo
i just used micsoft createwizard stuff its work but if i modify the things its doesn't work
like i added contentemplate and few more stuff it will not add in member fields its just add the username and password and
email id and rest of the fields blank.
and i just did wht you done in code of the example wht you specified in the previous post.
thanks,Jan Skovgaard !
is working on a reply...