Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Im trying to display items in a dropdown list according to the user id.The problem is that even though I log in with a diffrent username the previous or the very first username that i logged with is picked.I dnt know why its behaving like this.

To get the username in another web form im using
string username = HttpContext.Current.User.Identity.Name;

and username always remains of one persons name..and for the login im using:
C#
public void btnlogin_Click(object sender, EventArgs e)
  {
      using (DirectoryEntry entry = new DirectoryEntry())
      {
          //Session["username"] = txtusername;
          entry.Username = txtusername.Text;
          entry.Password = txtpassword.Text;

          DirectorySearcher searcher = new DirectorySearcher(entry);

          searcher.Filter = "(objectclass=user)";

          try
          {
              searcher.FindOne();

              lblrem.Text = "Successfull";
              Response.Redirect("Default2.aspx");
          }
          catch (COMException ex)
          {
              if (ex.ErrorCode == -2147023570)
              {
                  lblrem.Text = "Login Failed.Please ensure that your username and password is correct";
              }
          }
      }
Posted

clear cookies and try again, or try in different browser, did u use persistant state of cookie>>>>
 
Share this answer
 
If you don't have a different browser, you can try the "InPrivate Browsing" option.
And if the problem still persists you need to check your code through debugging.

Regards,
Venugopal
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900