잘 작동하는 로그인 페이지가 있습니다. 로그 아웃을 어떻게 할 수 있는지에 대한 도움을 받고 싶습니다. 내가 만든 CustomerLogin.cs 클래스를 보냅니다. 내가 가진 login1 내 웹 서비스에 대한 호출입니다. 아무도 나에게 무엇을해야한다고 말할 수 있습니까?로그인 - 로그 아웃 asp.net
public partial class CustomerLogin : System.Web.UI.Page
{
protected login1.login CustomerLog;
public CustomerLogin()
{
Page.Init += new System.EventHandler(Page_Init);
}
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["userId"] != null)
{
Server.Transfer("FirstPage.aspx");
}
}
private void Page_Init(object sender, EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
}
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.submitCusLogin.Click += new System.EventHandler(this.submitCusLogin_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void submitCusLogin_Click(object sender, System.EventArgs e)
{
string customerEmail;
string customerPassword;
customerEmail = txtEmail.Text;
customerPassword = txtPassword.Text;
//Make a call to the Web Service Login
CustomerLog = new login1.login();
//Access the Web method Customer_Details
string getId = CustomerLog.Customer_Details(customerEmail, customerPassword);
//Return a value.Check the value of the variable resultId and
//either grant the customer access or return an error message.
if (getId == "-1")
{
loginLabel.Text = "Invalid Login please re-enter your password and email!";
}
else
{
loginLabel.Text = "Welcome";
Session["userId"] = int.Parse(getId);
Server.Transfer((string)Session["return2Page"]);
}
}
}
사람들이 ASP.NET 기본 제공 로그인 컨트롤을 사용하지 않는 이유를 모르겠습니다. – Maysam
@Maysam, http://stackoverflow.com/a/6195965/368472 – Pratik