I am creating a new member in umbraco through .net coding .. But i cant pass the textbox value to the member fields, However a member gets created when i give the username,email as a string values.. How to solve this.. Any help..
Member m = Member.MakeNew(txtFullName.Text, mt, new umbraco.BusinessLogic.User
(0));
m.Email = txtEmail.Text;
string
pass = des3.Encrypt(txtPassword.Text);
m.Password = pass.ToString();
m.LoginName = txtFullName.Text;
m.getProperty(
"IsMainAdministrator"
).Value = cmbAdmin.SelectedItem.Value;
I am using the above code.. Only the password field gets populated with this value.. The LoginName and Email are null.. If i give the username and email as "somename","someemail" instead of textbox values then it gets stored in the member table....
Create New member
I am creating a new member in umbraco through .net coding .. But i cant pass the textbox value to the member fields, However a member gets created when i give the username,email as a string values.. How to solve this.. Any help..
Hi ss,
Assigning custom member properties should use the syntax:
General properties such as username and email can be accessed as properties on the member object.
Hope this helps.
Regards,
/Dirk
MemberType
(0));
m.Email = txtEmail.Text;
pass = des3.Encrypt(txtPassword.Text);
m.Password = pass.ToString();
m.LoginName = txtFullName.Text;
m.getProperty(
).Value = cmbAdmin.SelectedItem.Value;
I am using the above code.. Only the password field gets populated with this value.. The LoginName and Email are null.. If i give the username and email as "somename","someemail" instead of textbox values then it gets stored in the member table....
This may be an obvious question, but have you checked to make sure you have the correct fieldnames (if you're doing this outside of VS)?
Alternatively, please post your aspx and full cs so we can review.
Thanks,
Nik
Also, you should be using the .net membership functions to create the user... See this reference on the wiki
Cheers,
/Dirk
==========
<TABLE width="100%" align=left border=0><TBODY><TR>
=left>
>
>
=2>
>
>
="middle">
>
="middle">
>
>
="middle">
="Item">
>
>
>
="middle">
>
="middle">
>
>
="middle">
="False">
>
>
>
="middle">
>
="middle">
="server">
>
>
>
="middle">
="False">
>
>
>
cTripleDES
des3 = new cTripleDES
(key, iv);
if (btnAdd.Text == "Add"
)
{
if (Member.GetMemberFromEmail(txtEmail.Text) == null
)
{
MemberType mt = MemberType.GetByAlias("Administrator"
);
Member m = Member.MakeNew(txtFullName.Text, mt, new umbraco.BusinessLogic.User
(0));
m.Email = txtEmail.Text;
string
pass = des3.Encrypt(txtPassword.Text);
m.Password = pass.ToString();
m.LoginName = txtFullName.Text;
m.getProperty(
"IsMainAdministrator"
).Value = cmbAdmin.SelectedItem.Value;
m.Save();
lblerror.Visible =
true
;
lblerror.Text =
"Admin Created!"
;
BindGrid();
ClearItems();
}
else
{
lblerror.Visible =
true
;
lblerror.Text =
"Record May Be Already Exists!"
;
Hi SS,
Where r u from.
is working on a reply...