Today, I used jquery to perform a logon experiment. After clicking the logon button, the title is incorrect/
The online conclusion is:
Problem description: page A. aspx uses ajax to load B. aspx for paging. However, there is a server-side control in page a that needs to interact with the server to complete some functions.
However, an error message is displayed when you click the Server Control to prepare to interact with the server:
The status information of this page is invalid and may be damaged. Note: An unhandled exception occurs during the execution of the current Web request. Check the stack trace information for details about the error and the source of the error in the code. Exception details: system. Web. httpexception: The status information of this page is invalid and may be damaged. Source error:
[No relevant source line] |
Source File: C: \ WINDOWS \ Microsoft. NET \ framework \ v2.0.50727 \ temporary ASP. Net files \ teacherwebsite \ aba2332f \ c906139a \ app_web_ppk8ycdo.10.cs row: 0
Stack trace:
[Formatexception: invalid characters in the base-64 string.] System. Convert. frombase64string (string s) + 0 System. Web. UI. objectstateformatter. deserialize (string inputstring) + 67 System. Web. UI. objectstateformatter. system. Web. UI. istateformatter. deserialize (string serializedstate) + 4 System. Web. UI. util. deserializewithassert (istateformatter formatter, string serializedstate) + 37 System. Web. UI. hiddenfieldpagestatepersister. Load () + 136 |
|
|
The following solutions are provided for online query:
Add the following code to Web. config in the project:
<Pages enableeventvalidation = "false" viewstateencryptionmode = "never"/>
Source: http://www.cnblogs.com/ufo0303/archive/2008/04/10/1146026.html
However, the method provided on the Internet does not solve the problem.
So, see: http://blog.csdn.net/Yamzef/archive/2007/03/26/1541160.aspx. which says:
If you do not add these two sentences before the callback, _ theformpostdata adds the existing webpage status post data based on the original one,Now you have included two copies of post data in the callback.But the server still treats the callback as a part. As a result, the server cannot analyze the post data and only returns a message indicating that the webpage status is damaged.
Analysis may be caused by a form on the B page. Therefore, the form tag in B. aspx is deleted. The problem is solved.
My source code:
Code
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "logion. aspx. cs" inherits = "logion" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<SCRIPT type = "text/JavaScript" src = "JS/jquery-1.4.2.min.js"> </SCRIPT>
<Title> No title page </title>
<SCRIPT type = "text/JavaScript">
$ (Function (){
VaR messagetext = "";
$ ("# Tbxuser"). Focus (function (){
If ($ ("# messageuser"). Text () = "can be registered! ")
{
$ ("# Messageuser" Login .html ("You can register! "). Show ();
}
If ($ ("# messageuser"). Text () = "") $ ("# messageuser" ).html ("* User name starts with a letter or number! "). Show ();
// Else $ ("# messageuser" pai.html ("* username starts with a letter or number! "). Show ();
});
$ ("# Tbxuser"). Blur (function (){
VaR Param = $ ("# tbxuser"). Val ();
$ ("# Messageuser"). Load ("ajaxdata. aspx? Username = "+ Param, function (responsetext, textstatus, XMLHttpRequest ){
$ ("# Messageuser" pai.html (responsetext). Show ();
Messagetext = $ ("# messageuser"). Text ();
Function () {location. href = "index. aspx "};
Alert ("AA ");
});
});
});
</SCRIPT>
<Style type = "text/CSS">
<! --
* {Margin: 0; padding: 0 ;}
. Logion {width: 400px; Height: 25px ;}
. Beformessage {float: Left ;}
. Showmessage {float: Left; margin-left: 15px; display: none; font-size: 12px; color: red ;}
# Logionbutton {margin-left: 64px ;}
# Yanzhen {float: Left ;}
-->
</Style>
</Head>
<Body>
In the code, the $ ("# messageuser"). Load () method of jquery on the logion. ASP page is named ajaxdata. aspx.
In this case, the ajaxdata. ASPX page contains from and logion. asp also has from. Therefore, two post data copies are included in the callback, And the from Form Error in ajaxdata. aspx deletion is solved.