Hello. I have a little problem. Once a user logs in they can log out on the welcome page but I but a log out button on the other pages as well and when the user clicks the logout button nothing happens. What did I do wrong or forget? This is the page I put the logout button on that does not work.
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing.Printing;
public partial class FinancialProfileFormC : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PassConnectionString"].ConnectionString);
con.Open();
string insCmd = "Insert into TableFIN (FINYR, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, SCHOLARSHI, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP) values (@FINYR, @INSTRUCTIO, @RESEARCH, @PUBLIC_SER, @ACADEMIC_S, @STUDENT_SE, @INSTITUTIO, @PHYSICAL_P, @SCHOLARSHI, @AUXILIARY_, @HOSPITALS, @INDEPENDEN, @OTHEREXP)";
SqlCommand insertUser = new SqlCommand(insCmd, con);
insertUser.Parameters.AddWithValue("@FINYR", TextBoxCYF.Text);
insertUser.Parameters.AddWithValue("@TOTSL_REVE", TextBoxTRIR);
insertUser.Parameters.AddWithValue("@INSTRUCTIO", TextBoxInstr.Text);
insertUser.Parameters.AddWithValue("@RESEARCH", TextBoxRes.Text);
insertUser.Parameters.AddWithValue("@PUBLIC_SER", TextBoxPubS.Text);
insertUser.Parameters.AddWithValue("@ACADEMIC_S", TextBoxAcad.Text);
insertUser.Parameters.AddWithValue("@STUDENT_SE", TextBoxStudS.Text);
insertUser.Parameters.AddWithValue("@INSTITUTIO", TextBoxInstiS.Text);
insertUser.Parameters.AddWithValue("@PHYSICAL_P", TextBoxOperM.Text);
insertUser.Parameters.AddWithValue("@NET_AID", TextBoxNGAS.Text);
insertUser.Parameters.AddWithValue("@AUXILIARY_", TextBoxAuxE.Text);
insertUser.Parameters.AddWithValue("@HOSPITALS", TextBoxHosS.Text);
insertUser.Parameters.AddWithValue("@INDEPENDEN", TextBoxIndeO.Text);
insertUser.Parameters.AddWithValue("@OTHEREXP", TextBoxOE.Text);
try
{
insertUser.ExecuteNonQuery();
con.Close();
Response.Redirect("FinancialIndicatorsForm.aspx");
}
catch (Exception er)
{
Response.Write("You Have Successfully Submitted the Information!!!");
}
finally
{
}
}
protected void ButtonPrint_Click(object sender, EventArgs e)
{
}
protected void ButtonLogout_Click(object sender, EventArgs e)
{
Session["New"] = null;
Response.Redirect("Login.aspx");
}
}
Here is the code that does work.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class IALOPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["New"] = null;
Response.Redirect("Login.aspx");
}
}