Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • loic ponchon 36 posts 56 karma points
    Sep 07, 2011 @ 10:56
    loic ponchon
    0

    The parameter 'username' must not be empty

    Hello,

    I got this error 

    The parameter 'username' must not be empty.
    Parameter name: username

    it's failling to this line to the stacktrace

    System.Web.Security.ActiveDirectoryMembershipProvider.CheckUserName(String& username, Int32 maxSize, String paramName) +30
    

    but i don't want to reload the username before each page, someone knows how to keep it alive throw all pages ?

    Thanks you by advance

  • loic ponchon 36 posts 56 karma points
    Sep 09, 2011 @ 09:44
    loic ponchon
    0

    Up

  • loic ponchon 36 posts 56 karma points
    Sep 09, 2011 @ 15:58
    loic ponchon
    0

    Solved

  • Brian Powell 44 posts 199 karma points c-trib
    Jan 25, 2012 @ 21:07
    Brian Powell
    0

    Can you explain what you did to solve this problem?  I am encountering the same issue.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 25, 2012 @ 21:21
    Jan Skovgaard
    0

    Hi Brian

    Can you desribe what triggers the problem and what version of Umbraco that you're using?

    /Jan

  • Brian Powell 44 posts 199 karma points c-trib
    Jan 25, 2012 @ 22:25
    Brian Powell
    0

    I'm running Umbraco 4.7.1.  I'm trying to use the ActiveDirectoryMembershipProvider to handle both front-end and back-end logins.  It works OK for the backend user logins, but when I try to use it for the front-end members part I'm running intro trouble.  If I try to restrict a page to members only, a I get the "parameter username must not be empty" error.

    Stack trace is:

    [ArgumentException: The parameter 'username' must not be empty.
    Parameter name: username]
       System.Web.Util.SecUtility.CheckParameter(String& param, Boolean checkForNull, Boolean checkIfEmpty, Boolean checkForCommas, Int32 maxSize, String paramName) +2385941
       System.Web.Security.ActiveDirectoryMembershipProvider.CheckUserName(String& username, Int32 maxSize, String paramName) +30
       System.Web.Security.ActiveDirectoryMembershipProvider.GetUser(String username, Boolean userIsOnline) +86
       System.Web.Security.Membership.GetUser(String username, Boolean userIsOnline) +63
       umbraco.requestHandler..ctor(XmlDocument umbracoContent, String url) +4588
       umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) +1062
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.EventHandler.Invoke(Object sender, EventArgs e) +0
       System.Web.UI.Page.OnPreInit(EventArgs e) +9009622
       System.Web.UI.Page.PerformPreInit() +31
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328
  • Brian Powell 44 posts 199 karma points c-trib
    Jan 26, 2012 @ 08:50
    Brian Powell
    0

    I seem to have figured out a solution.  Basically, what is happening is that Umbraco tries verifying the username against the provider first even if there is nobody actively logged in yet.  The default ActiveDirectoryMembershipProvider sees the username is missing (because the user hasn't been prompted to enter it yet) then throws an exception.  Umbraco sees the exception and stops rather than giving the login prompt.

    To work around the problem, I ended up creating my own custom provider that overrides the GetUser() function in ActiveDirectoryMembershipProvider.  If the username string is null or empty, it retuns null.  Also, if GetUser() throws an exception, it catches the exception and returns null instead.  Umbraco sees the null return as a sign it should present the login dialog.

    My source is:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    
    namespace UmbracoMembership
    {
        public partial class CS101ADMembershipProvider : System.Web.Security.ActiveDirectoryMembershipProvider
        {
            public override MembershipUser GetUser(string username, bool userIsOnline)
            {
                // If username is blank, return nothing.
                if (String.IsNullOrEmpty(username))
                {
                    return null;
                }
    
                try
                {
                    return base.GetUser(username, userIsOnline);
                }
                catch (Exception e)
                {
                    return null;
                }
            }
        }
    }
    
  • Jerry 23 posts 73 karma points
    Mar 04, 2013 @ 02:26
    Jerry
    0

    I have the same issue, i create a member register usercontrol load by macros and when every input are empty and click the create user button, it came out below, what i expect is a reload or error message lable. should i over ride any classes? or any idear , i am so new on Umbraco.

     

     

    Server Error in '/' Application.


    The username of a Member must be different from an emptry string
    Parameter name: loginName

    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: The username of a Member must be different from an emptry string
    Parameter name: loginName

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [ArgumentException: The username of a Member must be different from an emptry string
    Parameter name: loginName]
       umbraco.cms.businesslogic.member.Member.GetMemberFromLoginName(String loginName) +509
       umbraco.providers.members.UmbracoMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +30
       System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +412
       System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +226
       System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +586
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +52
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691
    

     

  • Brian Powell 44 posts 199 karma points c-trib
    Mar 04, 2013 @ 02:33
    Brian Powell
    0

    Jerry,

    Your issue is separate from the original post.  The original post was about using ActiveDirectoryMembershipProvider but yours is about using Umbraco's member management.  You should create a new post so others can better find your question.

  • Jerry 23 posts 73 karma points
    Mar 04, 2013 @ 03:19
    Jerry
    0

    Thanks, i thought so ....it looks like catching anyinput that tag with UserName, Thank you anyway.

Please Sign in or register to post replies

Write your reply to:

Draft