Hi,
I want to clear my session variable on click of signout button.Here I am giving my code,Please check it and resolve.Thanks in advance
This is my login form code
private void Page_Load(object sender, System.EventArgs e)
{
sConnectionString=ConfigurationSettings.AppSettings["ConnectionString"];
Label2.Visible = false;
}
this is my submit button code of login form
private void cmdsub_Click(object sender, System.EventArgs e)
{
sqlTest = "select * from tbl_user where du_user='" + txtuser.Text+"' and du_pass='" + txtpass.Text +"'";
OleDbConnection dbConn = new OleDbConnection(sConnectionString);
dbConn.Open();
OleDbDataAdapter sqlad=new OleDbDataAdapter(sqlTest,dbConn);
DataSet ds=new DataSet();
sqlad.Fill(ds,"tbl_user");
int rowcount=ds.Tables["tbl_user"].Rows.Count;
if(rowcount>0)
{
Session["loginid"] = txtuser.Text;
Response.Redirect("ListDetail.aspx");
Label2.Visible = false;
}
else
{
Label2.Visible = true;
Label2.Text = "";
Label2.Text="Your id and password do not match";
}
}
this is my suggestion form code where i have to go sfter clicking on submit button of login form.code is below
mean this is page load of suggestion form
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoServerCaching();
HttpContext.Current.Response.Cache.SetNoStore();
if (Page.IsPostBack == false)
{
sConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
ddlministry.Items.Clear();
sqlTest = "select distinct(du_suggestname) from tbl_suggestion";
dbConn = new OleDbConnection(sConnectionString);
dbConn.Open();
OleDbDataAdapter sqlad = new OleDbDataAdapter(sqlTest, dbConn);
DataSet ds = new DataSet();
sqlad.Fill(ds, "tbl_suggestion");
for (int i = 0; i <= ds.Tables["tbl_suggestion"].Rows.Count - 1; i++)
{
ddlministry.Items.Add(ds.Tables["tbl_suggestion"].Rows[i][0].ToString());
}
}
This is my submit button code of suggestion.from where i choose my data from dropdownlist name ddlministry and click on submit button.
below code is for submit button of suggestion form
sConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
sqlTest = "select * from tbl_suggestion where du_suggestname='" + ddlministry.Text + "'";
OleDbConnection dbConn1 = new OleDbConnection(sConnectionString);
dbConn1.Open();
OleDbDataAdapter sqlad1 = new OleDbDataAdapter(sqlTest, dbConn1);
DataSet ds1 = new DataSet();
sqlad1.Fill(ds1, "tbl_suggestion");
DataView source = new DataView(ds1.Tables["tbl_suggestion"]);
DataGrid1.DataSource = ds1;
DataGrid1.DataBind();
A button is linkbutton from where i logeed out and code is below
Session["loginid"] = null;
Response.Redirect("login.aspx");
Problem is that when i click on logout button then it come into login page again but if i click on back button of internate explorer then it again come in suggestion form with data.but i want that after logout i don't want go into suggestion form pressing on back button also
Please help me thanks in advance