Bri*_*ott 13 asp.net http-verbs http-headers ispostback
我目前遇到一个奇怪的问题,即当我点击一个只返回同一页面的asp.net按钮时,除了谷歌Chrome之外的所有浏览器都在Page_Load事件中注册对IsPostback的调用为真.
这让我试着发现ASP .Net页面中的IsPostback属性是如何在技术上实现的,这是我很难找到的.
我的想法是,它可能与以下内容有关;
任何人都可以提供用于确定IsPostback布尔属性的条件的实际细分吗?
注意:我正在寻找实际的实现而不是感知/理论,因为我希望用它来积极解决问题.我也搜索过MSDN,迄今为止找不到任何准确覆盖该机制的技术文章.
布莱恩,提前谢谢.
Mar*_*ade 13
该页面查找__PREVIOUSPAGE
表单值的存在.
来自Reflector:
public bool IsPostBack
{
get
{ //_requestValueCollection = Form or Querystring name/value pairs
if (this._requestValueCollection == null)
{
return false;
}
//_isCrossPagePostBack = _requestValueCollection["__PREVIOUSPAGE"] != null
if (this._isCrossPagePostBack)
{
return true;
}
//_pageFlags[8] = this._requestValueCollection["__PREVIOUSPAGE"] == null
if (this._pageFlags[8])
{
return false;
}
return ( ((this.Context.ServerExecuteDepth <= 0)
|| ( (this.Context.Handler != null)
&& !(base.GetType() != this.Context.Handler.GetType())))
&& !this._fPageLayoutChanged);
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7054 次 |
最近记录: |