1, page Jump:
(1 server transmission
Server. Transer (http://www.jb51.net); when directed to a new page, the original URL is displayed, and the browser does not return to the original page, and the history is not recorded.
Applies to complete control transmissions, such as the Installation Wizard.
(2 hyperlinks
(3 browser redirect Redirect, fast, not sent to server
(4 cross-page Send postbackurl= "http://www.jb51.net"/>
Iscrosspagepostback is used to determine whether a cross-page commit
IsPostBack is used to check whether the current page is loaded for the first time, when the user first browses to the Web page, Page.IsPostBack returns false and returns true after loading.
2. Debugging
(1 modify the page instruction at the top of the. aspx page, add trace= "true" in the browser and view it, (corresponding status code), and remember to change the true back to false!!!!
(2 Insert trace log trace.warn ("Trace.Warn") ("CATEGORY", "one", EXCP);
Copy Code code as follows:
try {int a = 0; int b = 5/a;}
catch (System.Exception ex) {Trace.Warn ("Zzl", "calling b=5/a", ex);}
The browser will display in red and bright fonts:
(3 web.config application tracking trace
(4 breakpoint debugging
3, Form form: Get and post
Get is passed by URL, post is not displayed by hiding form values into HTTP messages
Get pass data is limited, post to pass large amount of data
However, Post will have a browser prompt to resubmit the form, and get No.
4, disable ViewState: Not read the last value to the client
Self-Increasing: addtest.ashx
Copy Code code as follows:
public void ProcessRequest (HttpContext context) {
Context. Response.ContentType = "Text/plain";
String IsPostBack = context. request["IspostBack"];
String value = "0";
if (IsPostBack = = "true") {
Value=context. request["num_01"];
int valueinint = Int. Parse (value);
valueinint++;
Value = Valueinint.tostring ();
}
String filepath = context. Server.MapPath ("addtest.htm");
String content = System.IO.File.ReadAllText (filepath);
Content = content. Replace ("@value", value);
Context. Response.Write (content);
}
html
Copy Code code as follows:
<form action= "Addtest.ashx" method= "POST" >
<input type= "hidden" name= "IspostBack" value= "true"/>
<input type= "hidden" name= "num_01" value= "@value"/>
<div> @value
</div>
<input type= "Submit" Name= "" value= "AddOne"/>
</form>
5. Cookies
Server returns data in addition to general HTML data, as well as cookies, the browser will update the cookie value to the local browser, may consume too much resources
Http://www.jb51.net so the site's picture server will be different from the main station domain name, reduce the cookie traffic transmission to optimize the site rate: http://www.myblogs.com/daomul.gif
6, each request will be new IHttpHandler interface of the class "Variable 1" of the instance to handle
When you're done with the GC, you don't keep the last value.
"Save" with static, all visitors will access the instance
Copy Code code as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
public partial class Vivideo_test_ variable 1:system.web.ui.page
{
private int i = 0;
private static int j = 0;
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Button1_Click (object sender, EventArgs e)
{
i++;
Label1.Text = i.ToString ();
j + +;
Label1.Text = J.tostring ();
}
}