我目前遇到一个奇怪的问题,即当我单击一个简单地回发到同一页面的 asp.net 按钮时,除了 Google Chrome 之外的所有浏览器都在 Page_Load 事件中注册对 IsPostback 的调用为真.
I'm currently having a strange issue whereby all browsers except from Google Chrome are registering a call to IsPostback within a Page_Load event as true when I click an asp.net button which simply posts back to the same page.
这使我尝试发现 ASP .Net 页面中的 IsPostback 属性在技术上是如何实现的,而我正在努力寻找.
This has led me to try and discover how the IsPostback property within an ASP .Net page is technically implemented, something I'm struggling to find.
到目前为止,我的想法是它可能与以下内容有关;
My thoughts to date are that it could be related to the following;
谁能提供用于确定 IsPostback 布尔属性的条件的实际细分?
Can anyone provide an actual breakdown of the conditions used to determine the IsPostback boolean property?
注意:我正在寻找实际实现而不是感知/理论,因为我希望使用它来积极解决问题.我还搜索了 MSDN,但迄今为止找不到任何准确涵盖该机制的技术文章.
Note: I'm looking for the actual implementation rather than perceptions / theory as I'm hoping to use this to actively resolve an issue. I've also searched MSDN and to date cannot find any technical article accurately covering the mechanism.
提前致谢,布赖恩.
页面查找是否存在 __PREVIOUSPAGE
表单值.
The page looks for the existence of a __PREVIOUSPAGE
form value.
来自反射器:
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);
}
}
这篇关于IsPostback 在技术上是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!