ASP Essence Digest-001 (Turn)

Source: Internet
Author: User
Tags execution flush header connect variable client visual studio
Essence | Digest-response object (2000.03.22)

Response objects

Response objects are useful and feature-rich. Here we are going to introduce to you the most basic function.
Of course it's all a lot more functional than we're here to introduce, but we think the 20% of the
The content is that you will be able to use it in 80% of the time. We think the main functions of the response object are as follows:

# RESPONSE. WRITE
# RESPONSE. Write can also be abbreviated to <%=%> such a format is simply embedded in the HTML language
# RESPONSE. The Redirect method allows the browser to try to connect to another URL
# RESPONSE. End can effectively terminate a continuous parsing of a script

Response Object Part II--buffer control
Response object error ' ASP 0156:80,004,005 '
Header Error
Whatever.asp, Line #
The HTTP headers are already written to the client browser.
Any HTTP header modifications must is made before writing page content.

Does this error message bother you as well?
But as long as you add the "<%response.buffer=true%>" line to any one page, mix redirects and
Web page content on the first line of the page, you will not see such a mistake again! This line will be released from the browser:
"HEADERS ARE already SENT" information.

The Buffer property indicates whether the page output is buffered. That is, when you add this property, all the information on the page is placed
Buffer page, until all server scripts for the current page have been processed before writing to the browser. If when browsing
After you have written something about it, you can no longer use Response.Redirect, because the browser
Can not write content and redirects (change direction).

The <%response.buffer=true%> basically tells the browser not to write anything until the event occurs:
A) Response.End before execution
b) Response.Flush before execution
c) before all server scripts for the current page have been processed
d The Response.Redirect command has been sent, and no content has been sent through Response.Flush before.

The only disadvantage of the <%response.buffer=true%> is that buffering will be before the server finishes all the scripts for the current page
Prevents the response from being displayed on the client. If the page takes a little time to organize (like extracting thousands of records from the database),
So that people don't see any information until the Web page is completely submitted to the browser, and the page seems to be
is not responding. To avoid this, it is common to use Response.Flush to allow the user to see that the organization has completed
Part of the page content.

The second part--redirect method of response object

The Redirect method causes the browser to attempt to connect to another URL, which is very similar to the functionality of <meta refresh> in HTML.
Here is an example of this approach:

<TITLE> formjump.asp </TITLE>
<form action= "formjumprespond.asp" method= "get" >
<select name= "Wheretogo"
<option SELECTED value= "Fun" >fun </OPTION>
<option value= "News" >daily News </OPTION>
<option value= "Docs" >asp IIS3 roadmap/docs </OPTION>
<option value= "main" >mainpage of activeserverpages.com </OPTION>
<option value= "Sample" >iis 3 sample ASP scripts </OPTION>
</SELECT>
<input type=submit value= "Choose destination"
</form>
</body>

The responder that reacts to this form is:

<%response.buffer=true%>
<title> formjumprespond.asp </title> &
<body bgcolor= "#FFFFFF" >
<%
' My ASP program so redirects to URL
Thisurl= "http://www.joyeasy.net/"
Where=request.querystring ("Wheretogo")
Select case where
Case "Main"
Response.Redirect Thisurl & "/"
Case "Samples"
Response.Redirect Thisurl & "/aspsamp/samples/samples.htm"
Case "Docs"
Response.Redirect Thisurl & "/iasdocs/aspdocs/roadmap.asp"
Case "News"
Response.Redirect "Http://www.sina.com"
Case "Fun"
Response.Redirect "Http://www.nease.com"
End Select
Response.Write "All dressed up and I don ' t know where to go <br>"
Response.Write "I recommend-->" & "<br>"
Response.Write Server.HTMLEncode (Thisurl & "/learn/test/res2.asp?where=fun") & "<br>"
Response.Write "For a good laugh!" & "<p>"
%>
</body> =============================================================================================================== ========================
Paste-How to use ASP to achieve Mailbox Access (2000.03.21)

How to use ASP to realize mailbox Access

Do you see this feature on some pages when you visit a Web site---you can access this site while
You can also see if there are any new messages in your free mailbox. Does this feature make you feel very exciting, very mysterious?
Below, I use ASP to give an example to let you know how to achieve this function.

First you can go to some sites that provide free mail services, apply for an account and log in. When you open a mailbox,
Please pay attention to the contents of the Address bar. Now take 371 as an example and you'll find that the content is usually:
Http://www.371.net/prog/login?user=fighter&pass=mypassword.
Where "fighter" is Your account, "MyPassword" is your password. Then we can get 3 messages from here.
The 1th article is that we got the URL and filename of the processing file: "Http://www.371.net/prog/login";
2nd is a record of your account variable name: User, 3rd is the record of your password variable name: Pass.
Once we know this information, we have the handwritten HTML file and ASP file.

'/*html source file contents are as follows: * *
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0"
</HEAD>
<title> City Club Home </title>
<style type= "Text/css"
!--
td {FONT-SIZE:9PT}
Body {font-size:9pt}
Select {FONT-SIZE:9PT}
A {text-decoration:none; color: #003366; font-size:9pt}
a:hover {text-decoration:underline; color: #FF0000; font-size:9pt}
-->
</style>
<script language= "JavaScript" >
function Check (TT) {
if (window.document.form1.selectmail.selectedindex==0) {
Alert ("Please select your mailbox



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.