开发者

View State Is Invalid By Use this.Form.Submit in IIS 7.5

View State Is Invalid By Use this.Form.Submit in IIS 7.5 A new WebSite, we test it on the IIS 6.0, it's OK. But when we test on the IIS 7.5, the "View State Is Invalid" is displayed.

The error information: Port: 3739 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ViewState: /wEPDwUJOTM1[*]MCIg... System.FormatException: Invalid length for a Base-64 char array

The [*] has been deleted becasue is too long, but the "MCIg..." is in the log.

I Check the source and find the next part:

<asp:Button ID="Btn_s开发者_如何学Cearch" runat="server" CssClass="submitbutton" 
   OnClientClick="javascript:this.disabled=true;this.form.submit();"
   Text="Search" UseSubmitBehavior="False" OnClick="Btn_search_Click" />

When i delete the [OnClientClick="javascript:this.disabled=true;this.form.submit();"] and delete [UseSubmitBehavior="False"]. The page will run Ok. It look like [this.form.submit] cause the error. But i test as follow 1. IIS 6.0, No Proxy , IE6.0 or IE8.0 Test OK. 2. IIS 6.0, Use Proxy , IE6.0 or IE8.0 Test OK. 3. IIS 7.5, Use Proxy, IE6.0 or IE8.0 Test OK. 4. IIS 7.5, No Proxy, IE6.0 or IE8.0 Test Error.

Do any one know why, use Proxy is OK ,otherwise error.


Your answer is probably __doPostBack(). Take a look here:

Explicit __doPostBack()

Your variant probably should look like this:

<asp:Button ID="Btn_search" runat="server" CssClass="submitbutton" 
   OnClientClick="this.disabled=true;__doPostBack('Btn_search','');return false;"
   Text="Search" OnClick="Btn_search_Click" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜