登录后退按钮问题 [英] Login back button problem
本文介绍了登录后退按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚发现,当我登录时,我可以点击退出按钮,我将退出该网站。我按下我的网络浏览器上的后退按钮,它让我回来没有任何错误或没有。我该怎么做才能解决这个问题。我该如何解决这个问题?
使用系统;
使用 System.Collections.Generic;
使用 System.Linq;
使用 System.Web;
使用 System.Web.UI;
使用 System.Web.UI.WebControls;
使用 System.Data.SqlClient;
使用 System.Configuration;
使用 System.Data;
public partial class 登录:System.Web.UI.Page
{
protected void Page_Load( object sender,EventArgs e)
{
}
protected void Button1_Click( object sender,EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings [ < span class =code-string> PassConnectionString]。ConnectionString);
con.Open();
if ( true )
{
SqlCommand level = new SqlCommand( 从TableSecurity中选择AccessLevel,密码其中EmailAddress = @EmailAddress AND Password = @Password,con);
level.Parameters.Add( new SqlParameter( EmailAddress,TextBoxEA.Text));
level.Parameters.Add( new SqlParameter( 密码,TextBoxPW.Text));
SqlDataReader reader = level.ExecuteReader();
DataTable dt1 = new DataTable();
dt1.Load(读者);
foreach (DataRow dr1 in dt1.Rows)
{
int returnedLevel = Convert.ToInt32(dr1 [ 0 ]。ToString());
if (returnedLevel == 1 )
{
回复。重定向( CEOPage.aspx);
}
else if (returnedLevel == 2 )
{
Response.Redirect( IALOPage.aspx跨度>);
}
}
}
con.Close();
请帮帮我。
谢谢!
}
}
解决方案
您的登录过程不对,请尝试表格认证,请点击此链接
http://www.asp.net/web-forms/tutorials/security/introduction/forms-authentication-configuration-and-advanced-topics-cs [ ^ ]
I just found out that when I login as a use that I can click the logout button and I will be logged out of the site. I pressed the back button on my web browser and it let me back in with no error or nothing. What should I do to fix this. How can I fix this?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["PassConnectionString"].ConnectionString);
con.Open();
if (true)
{
SqlCommand level = new SqlCommand("select AccessLevel, Password from TableSecurity where EmailAddress = @EmailAddress AND Password = @Password", con);
level.Parameters.Add(new SqlParameter("EmailAddress", TextBoxEA.Text));
level.Parameters.Add(new SqlParameter("Password", TextBoxPW.Text));
SqlDataReader reader = level.ExecuteReader();
DataTable dt1 = new DataTable();
dt1.Load(reader);
foreach (DataRow dr1 in dt1.Rows)
{
int returnedLevel = Convert.ToInt32(dr1[0].ToString());
if (returnedLevel == 1)
{
Response.Redirect("CEOPage.aspx");
}
else if (returnedLevel == 2)
{
Response.Redirect("IALOPage.aspx");
}
}
}
con.Close();
Please help me.
Thankes!!!
}
}
解决方案
Your login process is not right , try form authentication , follow this link
http://www.asp.net/web-forms/tutorials/security/introduction/forms-authentication-configuration-and-advanced-topics-cs[^]
这篇关于登录后退按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文