易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET防后退

如有页面Admin,则在其cs文件中写如下代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.AddHeader("Cache-Control", "no-cache");
Response.Expires = -1;
Response.Cache.SetNoStore();
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Last-Modified", DateTime.Now.ToString() + " GMT");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (Session["AdminNumber"] == null)
{
Response.Redirect("~/Login.aspx");
}
}
在Login页的cs文件中写如下代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.AddHeader("Cache-Control", "no-cache");
Response.Expires = -1;
Response.Cache.SetNoStore();
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Last-Modified", DateTime.Now.ToString() + " GMT");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (!IsPostBack)
{
Session.Clear();
}
}

如此便可轻松拒绝页面的回退!


相关文档:

Asp.net页面传值的几种方式

一、使用QueryString参数
QueryString将传递的值显示在浏览器的地址栏中,是一种非常简单也使用比较多的传值方式。
如果传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法
/// <summary>
/// 使用QueryString变量
/// </summary>
/// <param name="param1"></param>
/// ......

学习ASP.NET中的Application、Session、Cookie

学习ASP.NET中的Application、Session、Cookie
1.Application建立的变量,在系统内部任何地方都可以访问,通常网站地访问统计可能会用的较多。如果要用到Application首先在VS2005中建立一个global.asa文件。例如我们要写一个网站访问数量的统计的话,在global.asa中先声明变量iCount。如下所示:
     ......

ASP.NET页面传值_第八篇_WebConfig

+++ 修改WebConfig文件:
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="connStr" value="Data Source=ora11g;uid=scott;pwd=tiger;unicode=true"/>
  </appSettings>
  <connectionStrings>
    <ad ......

在asp.net中对XML文档进行的操作(不全,待续)

读XML文件
DataSet books = new DataSet();
books.ReadXml(MapPath("booklist.xml"));
booklist.DataSource = books;
booklist.DataBind(); ......

微软企业库5.0学习笔记(10)ASP.NET模块依赖注入

    您可以使用HTTP模块,一个到ASP.NET HttpApplicationState类的扩展,在Global.asax编写代码强制ASP.NET在每一个页面请求时自动注入依赖的对象,就像在ASP.NET Web窗体应用程序中讨论的一样.
    下列方法显示了一个合适的方法能够获取PreRequestHandlerExecute事件将它自己注入到ASP.NE ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号