0
   

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

 
 
kalyani
 
Reply Tue 17 Nov, 2009 03:29 am
with administrator loggin i create user and after completion of create user when i click to continue button from create wizard it goes to page showing list of users
but as soon as click button it aoutomaticaly recently created user loggen in and administrator session expires
plz give me solution to prevent it
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.Selected == true)
{
if (!Roles.IsUserInRole(username.Text, rdButtonListRoles.Items.Text))
{
Roles.AddUserToRole(username.Text, rdButtonListRoles.Items.Text.ToString());
}
}
else
{
if (Roles.IsUserInRole(username.Text, rdButtonListRoles.Items.Text))
{
Roles.RemoveUserFromRole(username.Text, rdButtonListRoles.Items.Text.ToString());
}
}

}


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

}

}
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 386 • Replies: 0
No top replies

 
 

Related Topics

already "logged in" - Question by MoBarb50
 
  1. Forums
  2. » in asp.net,c# when i create user it aoutomaticaly logged in to newly created user how can i prevent
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/19/2024 at 05:43:28