There are three ways to do the output redirection:
Response.SetRedect ("URL") This method is a redirected command to the browser to redirect the browser to the browser to redirect the browser to the browser. Response.sendredirect ("http: // localhost: 7001 / Index.html "); The following method can also change the HTTP header attribute, its principle and 1 is the same. <% response.setstatus (httpservletResponse.sc_moved_permanently); string newlocn =" / index.html "; response.setHeader "Location", newlocn);%> Using This method is to use the server side to output the data to the buffer. Before sending the contents of the buffer to the client, the original does not send, change Send this page, if there is a lot of output before , the previous output has made the buffer full and will automatically output to the client, then the statement will not work, this should pay special attention.
Description: 1. Method (1), (2) can use variables to represent a redirected address; method (3) cannot use variables to represent the address of the redirection. String add = "./ index.html"; Unable to redirect to index.html to string add = http: // localhost: 7001 / index.html response.sendredirect (add); You can redirect to http: // localhost: 7001 / index.html. 2. Using the method (1), (2) REQUEST (by request.setttribute () is used to save the value in the Request), the method (3) can be adopted in the new page. In summary, we should use (1), (2) The redirection is better.