具有母版页的asp.net c#for admin中的注销码 [英] Logout code in asp.net c# for admin which have master page

查看:50
本文介绍了具有母版页的asp.net c#for admin中的注销码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在点击退出按钮时保护注销代码。





我尝试了许多代码注销但可以'成功。

在点击退出按钮并按下浏览器的beck按钮后的许多代码中再次进入页面。





所以请给我发送安全注销码...







请帮帮我..



Rakesh

I want to secure code for logout when click on logout button.


I was try many code for logout but can't success.
In many codes after click on logout button and press beck button of browser then again go in page.


so please send me secure logout code...



please help me..

Rakesh

推荐答案

这不是注销代码的问题 - 这是因为后退按钮在浏览器中处理,不需要往返服务器。由于页面已经加载,浏览器只是从它的内部缓存中显示它,而不是在服务器上加载页面。



没有一个整体你可以做很多事情:最好的方法是在一个没有后退按钮的新窗口中打开你的网站。您可以通过在配置新窗口时将工具栏设置为否来获得该效果。
That is not a problem with the log out code - it is because the Back button is handled within the browser, and does not need a round-trip to the server. Since the page is already loaded, the browser just displays it from it's internal cache and doesn't do a page load at the server.

There isn't a whole lot you can do about it: the best approach is to open your site in a new window that doesn't have a back button. You can get that effect by setting the "toolbar" to "no" when you configure the new window.


单击注销按钮,将用户重定向到logout.aspx页面。在logout.aspx页面中添加以下代码。



Onclick of logout button, redirect user to logout.aspx page. Add following code in logout.aspx page.

protected void Page_Load(object sender, EventArgs e)
    {
        Session.Abandon();
        
        Response.Redirect(clsCommon.value("login.aspx?mode=logout");
    }


protected void LogIn_Click(object sender,EventArgs e)

{

Session.Add(uname,txtUname .Text);

Session.Add(pass,txtPass。文本);

DataTable dt = BusinessLayer.GetData(select * from tblLogin其中uid ='+ txtUname .Text +'和Upwd ='+ txtPass .Text +');

if(dt.Rows.Count == 0)

{

//lblmessage.Text =用户名或密码无效;

Response.Write(< script language = javascript> alert('你是无效用户')< / script>);

响应.Redirect(主页.aspx);

}

}





protected void LogIn_Click(object sender, EventArgs e)
{
Session.Add("uname", txtUname .Text );
Session.Add("pass", txtPass .Text );
DataTable dt = BusinessLayer.GetData("select * from tblLogin where uid='" + txtUname .Text + "' and Upwd='" + txtPass .Text + "'");
if (dt.Rows.Count == 0)
{
//lblmessage.Text = "Invalid username or password";
Response.Write("<script language=javascript>alert('You Are Invalid User')</script>");
Response .Redirect ("Home.aspx");
}
}


protected void lnkbtnlogout_Click(object sender, EventArgs e)
   {
       Session.Abandon();
       Session.Clear();
       Response.Redirect("~/Default.aspx");
   }


这篇关于具有母版页的asp.net c#for admin中的注销码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆