The status information on this page is invalid. The possible solutions and causes for the damage are analyzed.

Source: Internet
Author: User

The current situation was as follows:

A. The aspx page executes a URL string to access B. aspx, and then the B page returns a value to

A. aspx. cs code segment
Copy codeThe Code is as follows:
String result = "";
String url = "http: // localhost: 1759/textWeb/B. aspx ";
Result = exec_url (url );
Label1.Text = result;

Public string exec_url (string url)
{

String result = "1 ";
WebRequest request = WebRequest. Create (url );
Try
{
Request. Timeout = 20000; // Timeout in 20 seconds
WebResponse response = request. GetResponse ();

Stream resStream = response. GetResponseStream ();
StreamReader sr = new StreamReader (resStream );
Result = sr. ReadToEnd ();
Sr. Close ();
ResStream. Close ();
}
Catch
{
Return "1 ";
}
Return result;

}

B. aspx page code:
Copy codeThe Code is as follows:
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> No title page </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>


</Div>
</Form>
</Body>
</Html>

B. The aspx. cs code is as follows:
Copy codeThe Code is as follows:
Public partial class test: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
Response. Write ("Hello, haha! ");
}
}

Running time: the Label content is displayed normally for the first time, but the prompt is displayed when you click the button again without refreshing the page.

System. Web. HttpException: The status information of this page is invalid and may be damaged.

Cause:

It turns out that when the label loads the content for the first time, the content is B. aspx.

<Form>

Hello, haha!

</Form>

The principle of clicking again should be like this:

<Form>

Hello, haha!

<Form>

Hello, haha!

</Form>

</Form>

So an error occurred!

Solution: remove the form label in B. aspx.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.