YAFLogo

martijnvm
  • martijnvm
  • 56.6% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
Hello all,

I've integrated YAF into my existing 3.5 website, everything works fine except registering new users. The following error message is shown:

Exception Details: System.ArgumentException: The username parameter cannot be empty.

Parameter name: username

Source Error:

Line 172:

Line 173: if (!String.IsNullOrEmpty(roleName))

Line 174: Roles.AddUserToRole(userName, roleName);

Line 175: }

Line 176: }

Source File: D:\- Development\YafSubverion\YAF.Classes\YAF.Classes.Utils\MembershipHelper.cs Line: 174

Stack Trace:

[ArgumentException: The username parameter cannot be empty.

Parameter name: username]

System.Web.Util.SecUtility.CheckParameter(String& param, Boolean checkForNull, Boolean checkIfEmpty, Boolean checkForCommas, Int32 maxSize, String paramName) +1976575

System.Web.Security.Roles.AddUserToRole(String username, String roleName) +92

YAF.Classes.Utils.RoleMembershipHelper.SetupUserRoles(Int32 pageBoardID, String userName) in D:\- Development\YafSubverion\YAF.Classes\YAF.Classes.Utils\MembershipHelper.cs:174

YAF.Pages.register.CreateUserWizard1_CreatedUser(Object sender, EventArgs e) in c:\inetpub\wwwroot\Cms-Forums\forums\pages\register.ascx.cs:262

System.EventHandler.Invoke(Object sender, EventArgs e) +0

System.Web.UI.WebControls.CreateUserWizard.OnCreatedUser(EventArgs e) +111

System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +354

System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +102

System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +418

System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +161

System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +19

System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37

System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118

System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166

System.Web.UI.WebControls.Button.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) +36

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

Turns out that the UserNameproperty of the CreateUserWizard control in /pages/register.ascx.cs is empty (line 262).

Line 261: // setup inital roles (if any) for this user

Line 262: RoleMembershipHelper.SetupUserRoles(YafContext.Current.PageBoardID, CreateUserWizard1.UserName);

After moving the web.config file, Bin and App_Code folders from my website root to the YAF folder, setting YAF as an application in IIS and modifying the YAF.Root application key value, I'm able to register new users.

For testing I use the default default.aspx page, so it cannot be a problem with masterpages or something like that. I use my own custom providers for membership, roles and profiles. The providers aren't the problem probably, because they work when YAF is configured as a standalone application.

Does anyone have a clue why integration leads to the empty UserName property?

Thanks!

Martijn

Sponsor

mddubs
  • mddubs
  • 100% (Exalted)
  • YAF Developer
13 years ago
Martijn,

I got your email and I'm reading your problem here but nothing is jumping out at me. I would first try stepping through your code.


UserPostedImage 

www.bunkerhollow.com  | www.careercomputing.com 

When I post fp:mddubs in a topic, I'm leaving my footprint there so I can track it once I get into coding/supporting. (Yes I stole this off Mek 🙂, who stole this off Ederon 🙂 )