Hello friends ,
I Made a web application in which i have one login page after successful login session value is set like
Session["user"]=txtusername.Text;
Then I have one master page On which i am checking the session value i.e.
if (Session["user"] == null)
{
Session.Abandon();
Response.Redirect("Login_Master.aspx");
}
then i have one other form for data entry which is basicaaly the child page of master page when i click one save but after filling all the required field it somtimes redirect to login page with out saving data and somtime it save.
this application is working when hosted or debug locally but this problem arises when it hosted on web server remotely.
coding for data entry page is shown below :
string accname = ddlaccname.SelectedValue.ToString();
string accman = ddlaccmanager.SelectedValue.ToString();
string currentdate = DateTime.Now.ToString("dd/MM/yyyy");
string[] products = new string[ListBox1.Items.Count];
string[] productsname = new string[ListBox1.Items.Count];
int progress = Convert.ToInt32(ddlprogress.SelectedValue.ToString());
for (int i = 0; i < ListBox1.Items.Count; i++)
{
products[i] = ListBox1.Items[i].Value.ToString();
productsname[i] = ListBox1.Items[i].ToString();
}
string emp_id = Session["emp_id"].ToString();
string insert="insert query for data inserion";
string insert1="insert query 1 for data inserion";
SqlTransaction st;
con.Open();
st = con.BeginTransaction();
try
{
new SqlCommand(insert, con, st).ExecuteNonQuery();
new SqlCommand(insert1, con, st).ExecuteNonQuery();
for (int j = 0; j < ListBox1.Items.Count; j++)
{
string insert3="insert query 3 for data inserion";
new SqlCommand(insert3, con, st).ExecuteNonQuery();
}
st.Commit();
con.Close();
Response.Redirect("LEAD_MASTER.aspx");
I don't know what is the main problem please suggest some solution for that my session timeout by default is set to 1Hour which is not a problem .