I'm trying to programmatically create members...once I check inputed user credentials (user) exist in a separate database I would like to see if the with the username and password exist already and if member don't exists yet I try to create the members using member type "test" I already created in the Umbraco backend...and there it fails: MemberType.GetByAlias("test"); just breaks returning: No node exists with id '0'.
Any1 help please?
TIA
Here's the data:
Umbraco version 4.0.3
asp.net 3.5, win2k8, iis7
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.ArgumentException: No node exists with id '0'
Source Error:
Line 182: if (User != null)
Line 183: {
Line 184: MemberType mt = MemberType.GetByAlias("test");
Line 185: Member m = Member.GetMemberFromLoginNameAndPassword(TextBoxUserName.Text, TextBoxPassword.Text);
From looking at your exception message, it looks like you don't have a member type with the alias of "test". The name/alias is case-sensitive, so double-check what you've named it in the Umbraco back-end? (Guessing it could be "Test"?)
I've tried it all. Uppercase, lowercase (all of it..including alias and/or name) but still the same error message :-/
I've found one prior post suggesting to look at umbraco.config...looked at umbraco.config and it's not there...no membertype "test" even though it's always there when using the backend.
Maybe delete umbraco.config as per the prior mentioned post could help solve it...or where should the membertypes be stored at...or is it groups, or maybe some web.config thing.
Dunno, please help ;(
p.s.
thanks for the quick response voted for ya in the mvp vote :)
The "umbraco.config" is only used for the content's XML cache (from the document-types). Everything else, like media, members, users, etc - they are all pulled from the database when required. So there won't be any signs of member-types in the "umbraco.config".
Obviously without seeing your Umbraco set-up, it's all guess-work for me. (If you do want me to take a quick peak, then email me via my contact form).
Other ideas... could you be mixing up document-types and member-types? (or even user-types?) (Guessing no, but have to ask)
Can you manually create a new member in the back-office using the "test" member-type?
Tnx yet again for the info...I've solved the problem...though I'm still not sure just how and why, hope it will not return, I'll be using the new practice of rebuild all now :)
However. As I've said, thought contact form, I do have a new problem. XSLT macro won't work with <xsl:value-of select="umbraco.library:GetCurrentMember()/data[@alias='test-path']"/> (where test-path is the membertype backend defined property - all lowercase). I've read somewhere accessing custom member properties should be done through C# XSLT extensions in v4, however this seems strange to me, why if v3 could use XSLT would you disable such an easy to use feature in v4?!
Much obliged for any help you couldg give please...
P.S.
vote is not a problem, only sorry you can't vote more than once now, you deserved it in my book (plus "North by Northwest is a cool movie":)
And the naming convention troubles seem to continue...I've changed the custom member property name from frame-path to just frame and it worked...exactly why is beyond me?
However, I've noticed what I could call a delay, changing the custom member property value in Umbraco backend doesn't work immediatelly. I have to logout and login to see the change (if then...sometimes have to do it a couple of times).
I'm preety sure it's got something to do with the code which was copied from the project used to build the login control which goes something like:
if (UseCookiesForAuthentication && chkRememberMe.Checked)
Will have to go into Umbraco API sooner than I thought to understand that...but how about some quick tips please...or could you recommend a place to read all this plaese. TIA
No node exists with id '0'
I'm trying to programmatically create members...once I check inputed user credentials (user) exist in a separate database I would like to see if the with the username and password exist already and if member don't exists yet I try to create the members using member type "test" I already created in the Umbraco backend...and there it fails: MemberType.GetByAlias("test"); just breaks returning: No node exists with id '0'.
Any1 help please?
TIA
Here's the data:
Umbraco version 4.0.3
asp.net 3.5, win2k8, iis7
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.ArgumentException: No node exists with id '0'
Source Error:
Line 182: if (User != null)
Line 183: {
Line 184: MemberType mt = MemberType.GetByAlias("test");
Line 185: Member m = Member.GetMemberFromLoginNameAndPassword(TextBoxUserName.Text, TextBoxPassword.Text);
Line 186:
Source File: C:\TEMP\MemberControls\usercontrols\umbLogin.ascx.cs Line: 184
Stack Trace:
[ArgumentException: No node exists with id '0']
umbraco.cms.businesslogic.CMSNode.setupNode() +459
umbraco.cms.businesslogic.CMSNode..ctor(Int32 Id) +25
umbraco.cms.businesslogic.member.MemberType.GetByAlias(String Alias) +118
umbracoMemberControls.umbLogin.ButtonLogin_Click(Object sender, EventArgs e) in C:\TEMP\MemberControls\usercontrols\umbLogin.ascx.cs:184
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +111
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +79
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Hi stc,
From looking at your exception message, it looks like you don't have a member type with the alias of "test". The name/alias is case-sensitive, so double-check what you've named it in the Umbraco back-end? (Guessing it could be "Test"?)
Cheers, Lee.
Hi Lee,
I've tried it all. Uppercase, lowercase (all of it..including alias and/or name) but still the same error message :-/
I've found one prior post suggesting to look at umbraco.config...looked at umbraco.config and it's not there...no membertype "test" even though it's always there when using the backend.
Maybe delete umbraco.config as per the prior mentioned post could help solve it...or where should the membertypes be stored at...or is it groups, or maybe some web.config thing.
Dunno, please help ;(
p.s.
thanks for the quick response voted for ya in the mvp vote :)
Hi stc,
The "umbraco.config" is only used for the content's XML cache (from the document-types). Everything else, like media, members, users, etc - they are all pulled from the database when required. So there won't be any signs of member-types in the "umbraco.config".
Obviously without seeing your Umbraco set-up, it's all guess-work for me. (If you do want me to take a quick peak, then email me via my contact form).
Other ideas... could you be mixing up document-types and member-types? (or even user-types?) (Guessing no, but have to ask)
Can you manually create a new member in the back-office using the "test" member-type?
Let me know how it goes.
Cheers, Lee.
(Thanks for your vote, much appreciated!)
Hi Lee,
Tnx yet again for the info...I've solved the problem...though I'm still not sure just how and why, hope it will not return, I'll be using the new practice of rebuild all now :)
However. As I've said, thought contact form, I do have a new problem. XSLT macro won't work with <xsl:value-of select="umbraco.library:GetCurrentMember()/data[@alias='test-path']"/> (where test-path is the membertype backend defined property - all lowercase). I've read somewhere accessing custom member properties should be done through C# XSLT extensions in v4, however this seems strange to me, why if v3 could use XSLT would you disable such an easy to use feature in v4?!
Much obliged for any help you couldg give please...
P.S.
vote is not a problem, only sorry you can't vote more than once now, you deserved it in my book (plus "North by Northwest is a cool movie":)
Hi stc,
I replied to your email, but I'll post here for anyone who is curious.
I'd suggest that you store the member data in an <xsl:variable>, like so:
Then you can take a look at what is inside the member node - to see if there is any data there:
Cheers, Lee.
PS. With the voting, I meant on a forum/topic level ... but thank you for the MVP vote - it's much appreciated! :-D
And the naming convention troubles seem to continue...I've changed the custom member property name from frame-path to just frame and it worked...exactly why is beyond me?
However, I've noticed what I could call a delay, changing the custom member property value in Umbraco backend doesn't work immediatelly. I have to logout and login to see the change (if then...sometimes have to do it a couple of times).
I'm preety sure it's got something to do with the code which was copied from the project used to build the login control which goes something like:
if (UseCookiesForAuthentication && chkRememberMe.Checked)
Member.AddMemberToCache(m, false, new TimeSpan(_DaysUntilCookieExpires, 0, 0, 0));
else
Member.AddMemberToCache(m, true, new TimeSpan(0, 0, 0));
Will have to go into Umbraco API sooner than I thought to understand that...but how about some quick tips please...or could you recommend a place to read all this plaese. TIA
is working on a reply...