ASP.NET避免页面重新整理时重复发送...
我们可以继承 ASP.NET 的 Page 类别,自行扩充所需的功能!作法如下:
1、继承 System.Web.UI.Page,自订一个 BasePage 类别。
以下为引用的内容:
using
System;
/// <summary>
/// BasePage 的摘要描述
/// </summary>
public
class
BasePage : System.Web.UI.Page
{
public
BasePage() { }
}
2、在 BasePage 类别底下撰写 SetActionStamp 方法,目的是在 Session 存放一个系统时间戳记。
以下为引用的内容:
/// <summary>
/// 設置戳記
/// </summary>
private
void
SetActionStamp()
{
Session[
"actionStamp"
] = Server.UrlEncode(DateTime.Now.ToString());
}
3、处理 PreRender 事件,在网页初次载入时设置戳记,且每次载入执行时会把该戳记存放到 HiddenField 里。
以下为引用的内容:
public
BasePage() {
this
.PreRender +=
new
EventHandler(Page_PreRender); }
void
Page_PreRender(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
SetActionStamp();
}
ClientScript.RegisterHiddenField(
"actionStamp"
, Session[
"actionStamp"
].ToString());
}
4、自订 IsRefresh 属性,藉由判断 HiddenField 存放的戳记是否等于 Session
裡存放的值,就可以得知网页是否经由重新整理动作回传。
以下为引用的
相关文档:
配置iis6解决运行asp.net mvc项目“无法找到该页”的错误
在iis6运行asp.net mvc 项目时,如果出现“无法找到该页”的提示,即404错误,那么有可能是iis没有设置好,按下面操作可以解决:
打开iis管理器,右击相应的网站节点,选择“属性”快捷菜单,弹出属性对话框,选择“主目录&rd ......
前台代码:
<script type="text/javascript">
<%=LoadImage() %>
imgUrl1="uploads/"+ImgSrc[0];
imgtext1=ImgAlt[0]
imgLink1=escape("adimg.aspx?Img_ID="+ImgUrl[0]);
imgUrl2="uploads/"+ImgSrc[1];
imgtext2=ImgAlt[1]
imgLink2=escape("adimg.aspx?Img_ID="+ImgUrl[1]);
imgUrl3=" ......
比如用一个类描述一张合同,而这个类实例化后其中的字段保存着合同的信息,如果现在要把这个类的实例发送到另一台机器、另一个窗体或是想保存这个类以便以后再取出来用(持久化对象),可以对这个类进行序列化(序列化实际上是一个信息流),传送或保存,用的时候再反序列化重新生成这个对象
为什么您想要使用序列化 ......
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Mat ......
Request.ServerVariables["Url"]
返回服务器地址
Request.ServerVariables["Path_Info"]
客户端提供的路径信息
Request.ServerVariables["Appl_Physical_Path"]
与应用程序元数据库路径相应的物理路径
Request.ServerVariables["Path_Translated"]
通过由虚拟至物理的映射后得到的路径
Request.ServerVariables ......