More in this section
Forums / Suggestions / in asp.net,c# when i create user it aoutomaticaly logged in with newly created user how can i prevent

in asp.net,c# when i create user it aoutomaticaly logged in with newly created user how can i prevent

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. track vts
    track vts avatar
    2 posts
    Registered:
    17 Nov 2009
    17 Nov 2009
    Link to this post
    heloo
    as soon i click on continue button administrator login changes to newly created user
    plz give me solution to prevent it plz help me
    public partial class CreateUser : System.Web.UI.Page
    {
        TextBox username;
        protected void Page_Load(object sender, EventArgs e)
        {
            Class1.OpenConn();
            string[] rolesArray;
            if(!(IsPostBack))
            {        
                rolesArray = Roles.GetAllRoles();
                rdButtonListRoles.DataSource = rolesArray;
                rdButtonListRoles.DataBind();
            }
            if(IsPostBack)
            {
                Class1 cs = new Class1();
                username = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName");
                ProfileCommon newProf;
                newProf = Profile.GetProfile(username.Text);
                TextBox MobileNo, name, Sirname;
                name = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtname");
                Sirname = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtSirname");
               MobileNo = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("MobileNo");

                newProf.Name = name.Text;
                newProf.Sirname = Sirname.Text;
                newProf.MobileNo = MobileNo.Text;
                
                newProf.Save();
               RoleDiv.Visible = false;
            }
        }


        protected void ContinueButton_Click(object sender, EventArgs e)
        {
          
            for (int i = 0; i < rdButtonListRoles.Items.Count; i++)
            {

                if (rdButtonListRoles.Items[i].Selected == true)
                {
                    if (!Roles.IsUserInRole(username.Text, rdButtonListRoles.Items[i].Text))
                    {
                        Roles.AddUserToRole(username.Text, rdButtonListRoles.Items[i].Text.ToString());
                    }
                }
                else
                {
                    if (Roles.IsUserInRole(username.Text, rdButtonListRoles.Items[i].Text))
                    {
                        Roles.RemoveUserFromRole(username.Text, rdButtonListRoles.Items[i].Text.ToString());
                    }
                }

            }


            Response.Redirect("ManageUser.aspx");
        }
        protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {

        }
        
    }

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 Nov 2009
    Link to this post
    Hello track vts,

    You can set LoginCreatedUser property of CreateUserWizard control to false; This should prevent the auto logging.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered