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.
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;
}
}
}
}
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
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.
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
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
Up
Solved
Can you explain what you did to solve this problem? I am encountering the same issue.
Hi Brian
Can you desribe what triggers the problem and what version of Umbraco that you're using?
/Jan
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:
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:
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:
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.
Thanks, i thought so ....it looks like catching anyinput that tag with UserName, Thank you anyway.
is working on a reply...