Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I have i application which is hosted on the server when i login from one account
from my browser(google chrome)

then again i login my opening a new tab in the browser but with the diffrent login credentials

In first tab which i have previously loged when i browsing i am getting information of the different log in which i have logged in the new tab

how do i avoid
Posted
Comments
Vinodh.B 21-Nov-13 2:32am    
Can you share the code of Login Button click ?
surajemo 21-Nov-13 2:51am    
protected void btnLogin_Click(object sender, EventArgs e)
{
string strusertype = string.Empty;
try
{
if (TxtPassword.Text != "" & TxtUsername.Text != "" & txtMId.Text != "")
{
DataSet dsselectLogin = new DataSet();
//here the password is encrypted.
string encrypt = Encrypt(TxtPassword.Text.ToString());

// string decr = Decrypt(TxtPassword.Text.Trim().ToString());

SqlParameter[] loginparam = new SqlParameter[3];
loginparam[0] = new SqlParameter("Username", TxtUsername.Text);
loginparam[1] = new SqlParameter("Password", encrypt);
loginparam[2] = new SqlParameter("MhealthId", txtMId.Text);

//for getting the username,mhealthid,usertype and password
dsselectLogin = obj.ExecuteSP("adm_login_select", loginparam);
if (dsselectLogin.Tables[0].Rows.Count > 0)
{
//Session.Abandon();
//Session.Clear();
//Session.RemoveAll();

Session["Name"] = Convert.ToString(dsselectLogin.Tables[0].Rows[0]["FullName"]);
strusertype = Convert.ToString(dsselectLogin.Tables[0].Rows[0]["usr_UserType"]);

// user type 1 = Pathology, 2 -docotr 3- patient 4-Hospital Associate-5 and Pharmacy-6
Session["UserType"] = strusertype.ToString();

Session["usr_mHealthId"] = Convert.ToString(dsselectLogin.Tables[0].Rows[0]["usr_mHealthId"]);
Session["Id"] = dsselectLogin.Tables[0].Rows[0]["usr_Id"].ToString();
Session["BranchId"] = dsselectLogin.Tables[0].Rows[0]["usr_JobLocation"].ToString();
Session["ClinicId"] = dsselectLogin.Tables[0].Rows[0]["usr_JobLocation"].ToString();
//get the role
Session["ROLE"] = Convert.ToString(dsselectLogin.Tables[0].Rows[0]["Role"]);
if (strusertype == "3")
{
Response.Redirect("View/Patient/Dashboard.aspx", false);
}
if (strusertype == "6")
{
Response.Redirect("View/Pharmacy/Prescriptions.aspx", false);
}
else if (strusertype == "5")
{
Response.Redirect("View/pathology/RequisitionList.aspx", false);
}
// Check Plan Term
SqlParameter[] PlanTermparam = new SqlParameter[1];
PlanTermparam[0] = new SqlParameter("MhealthId", txtMId.Text);
DataSet DsPlanTerm = obj.ExecuteSP("ml_GetPlansTerm", PlanTermparam);

if (DsPlanTerm.Tables[0].Rows.Count > 0)
{
string Term = Convert.ToString(DsPlanTerm.Tables[0].Rows[0]["T_Period"]);
// DateTime PlanStartDate = Convert.ToDateTime(DsPlanTerm.Tables[0].Rows[0]["pay_CreatedDate"]);
DateTime PlanStartDate = DateTime.ParseExact(Convert.ToDateTime(DsPlanTerm.Tables[0].Rows[0]["pay_CreatedDate"]).ToString("dd-MMM-yyyy"), "dd-MMM-yyyy", CultureInfo.GetCultureInfo("hi-IN"));

string Number = ExtractNumber(Term);
int NumberOfMonths = 0;
if (Term.Contains("Months"))
{
NumberOfMonths = Convert.ToInt32(Number);
}
else
surajemo 21-Nov-13 3:04am    
I tried like this <sessionstate mode="InProc" cookieless="UseUri"> tested it is working
if its not testing team will report waiting for their approval now
surajemo 21-Nov-13 3:06am    
<sessionstate mode="InProc" cookieless="UseUri">

1 solution

Hi

Test the following code

XML
<configuration>
<system.web>
<sessionstate cookieless="true">
regenerateExpiredSessionId="true" />
  </sessionstate>
</system.web>
</configuration>


Please mark it as answer if it resolves your problem .
 
Share this answer
 
v3

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