Hi,
i have the session problem.
below the code please help me.
Web.config
<sessionstate mode="SQLServer" sqlconnectionstring="data source= ;integrated security=true;Initial Catalog=;pooling=false" timeout="40" allowcustomsqldatabase="true" />
Global.aspx
public static int numofcount = 0;
void Session_Start(object sender, EventArgs e)
{
Session["numberofAttempts"] = numofcount;
}
Login.aspx.cs
private int numberofAttempts = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!Session.IsNewSession && Request.UrlReferrer == null)
{
Session["numberofAttempts"]=0;
}
if (Session["numberofAttempts"] != null)
{
numberofAttempts = Convert.ToInt32(Session["numberofAttempts"]);
}
}
Button_Click
Passing numberofattempts to the stored procedure and returning error message:
ObjclientManager.GetLogin(UserName.Value, EncryptedPswrd, Client.Value, numberofAttempts);
After Result from database through stored Procedure:
if (objclientuserInfo.Message=="INVALID_USR_PSWRD")
{
numberofAttempts = Convert.ToInt32(Session["numberofAttempts"]) + 1;
Session["numberofAttempts"] = numberofAttempts;
}
It is working fine .
But if I will open a new tab in same browser or Different browser, then it should not store the previous numberof attempts.
It is storing the number of attempts in different browser.