B.aspx:<%@ Page EnableViewStateMac="false" %>

解决方案 »

  1.   

    Ms的Bug:
    参照:
    http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316920The Server.Transfer ViewState Bug
    As mentioned, ASP.NET 1.1 comes with a full bag of bug fixes. I'd like to mention a couple of them here that affected 1.0 applications and magically disappeared in the newest version. The Server.Transfer method has a couple of overloads. The first one takes the URL to transfer control to; the second one claims an additional boolean argument indicating whether or not the QueryString and Form collections are to be preserved. The default is false and the collections are emptied before the control is transferred. When the Transfer method is used to execute a new page, for performance reasons the current HTTP handler is recycled and the context is shared. In doing so, the new page happens to work with the viewstate of the previous page (the __VIEWSTATE hidden field) still stored in the Form or QueryString collection. Subsequently, a viewstate corruption is detected and an exception is fired. This bug is fully described in KB 316920 and also affects the Server.Execute method. 
      

  2.   

    按您所说,第二个参数为TRUE的重载方法是没有办法用了,我们必须通过另外的途径在页面间传递参数了?如果要传递很多的参数又怎么办呢?
      

  3.   

    B.aspx:<%@ Page EnableViewStateMac="false" %> 测试可以通过,多谢了,CAUSE
    This problem occurs because the EnableViewStateMac attribute of the <pages> element is set to true by default. When this attribute is set to true, ASP.NET runs a message authentication check (MAC) on the view state of the page when the page is posted back from the client. This check determines if the view state of the page was modified on the client. For security purposes, it is recommended that you keep this attribute set to true.When you call the Server.Transfer method and set the second parameter to true, you preserve the QueryString and the Form collections. One of the form fields is the hidden __VIEWSTATE form field, which holds the view state for the page. The view state message authentication check fails because the message authentication check only checks each page. Therefore, the view state from the page that calls Server.Transfer is not valid on the destination page.View state is page scoped and is valid for that page only. View state should not be transferred across pages. 
      

  4.   

    终止执行当前页,并开始使用新页的指定 URL 路径来执行新页。
    你要把要传的控件放在this.Server.Transfer(b.aspx)后面吧