Copied to clipboard

Flag this post as spam?

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


  • adarsh 46 posts 66 karma points
    Jun 23, 2011 @ 14:11
    adarsh
    0

    Registration Form Page

    Hi i am just creating the registration page for user to login.

    if i use the create wizard control its works fine,

    iam following the post of Tim http://umbraco.miketaylor.eu/2010/08/29/authenticating-new-members/

    but in method of createuser method

    CreateUserWizard cuw = (CreateUserWizard)sender;
    MembershipUser user = Membership.GetUser(cuw.UserName);
    if(user ! = null)
    {
    string newUserGuid = System.Guid.NewGuid().ToString("N");
    MemberProfile me= MemberProfile.GetUserProfile(cuw.UserName);

    me.AuthGuid= newUserGuid;
    me.FirstName =((TextBox) cuw.CreateUserStep.ContentTemplateContainer.FindControl("FirstName")).Text;
    me.MiddleName =((TextBox) cuw.CreateUserStep.ContentTemplateContainer.FindControl("MiddleName")).Text;
    me.LastName =((TextBox) cuw.CreateUserStep.ContentTemplateContainer.FindControl("LastName")).Text;
    me.Save();
    Roles.AddUsersToRole(cuw.UserName,"SiteMembers");

    HyperLink hlAuth = (HyperLink)cuw.CompleteStep.ContentTemplateContainer.FindControl("hlAuth");
    if(hlAuth != null)
    {
    hlAuth.NavigateUrl ="http://" + Request.ServerVariables["HTTP_HOST"] + Request.ApplicationPath.TrimEnd('/')+ "/auth.aspx?a=" +user.UserName + "&b=" + newUserGuid;

    hlAuth.Text = hlAuth.NavigateUrl;

    its showing the error local variable membership user cannot implicity convert type

    system.web.securty.membership to bool

    and other error is

    Roles.AddUsersToRole(cuw.UserName,"SiteMembers");

    the system.web.security.roles.adduser.torole(string[],string) has some invalid arguments

    Thanks

    Adarsh

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 23, 2011 @ 14:28
    Tom Fulton
    0

    What line is getting the first error?

    The second error is probably because you are using AddUsersToRole, which is meant to add multiple users to a role and accepts a string array as input, but you are only sending a single string.  Try using AddUserToRole instead?

    -Tom

  • adarsh 46 posts 66 karma points
    Jun 23, 2011 @ 15:07
    adarsh
    0

    Hi Tom, its was my mistake thanks.

    the first error is

    MembershipUser user =Membership.GetUser(cuw.UserName);
           
    if(user !=null)

    local variable membership user cannot implicity convert type

    system.web.securty.membership to bool

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 27, 2011 @ 14:10
    Tom Fulton
    0

    Hi..did you figure this out yet?  In your first post there is a space between ! and = which would cause this error.

  • adarsh 46 posts 66 karma points
    Jun 27, 2011 @ 15:00
    adarsh
    0

    Hi Tom,

    i did

    thanks.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies