How does IsPostback technically work?

前端 未结 3 492
遥遥无期
遥遥无期 2020-12-01 11:26

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 as

3条回答
  •  抹茶落季
    2020-12-01 12:01

    Is Postback is implemented as such (using Reflector):

    public bool get_IsPostBack()
    {
        if (this._requestValueCollection == null)
        {
            return false;
        }
        if (this._isCrossPagePostBack)
        {
            return true;
        }
        if (this._pageFlags[8])
        {
            return false;
        }
        return (((this.Context.ServerExecuteDepth <= 0) || ((this.Context.Handler != null) && !(base.GetType() != this.Context.Handler.GetType()))) && !this._fPageLayoutChanged);
    }
    

    So unless you take into account all these parameters, it will not be possible to trace it.

提交回复
热议问题