Page 253 - DCAP408_WEB_PROGRAMMING
P. 253

Unit 10: Working with Response Object




          Sending the User to Another Page                                                      Notes

          There are HTML Web pages that are on the screen for just a few seconds and then suddenly it
          takes you to another page. This can be done in many ways.
          One way uses the META tag:

          <META  HTTP-EQUIV=REFRESH  CONTENT=_  “2;URL=http://www.macmillan.com”>
          this causes the browser to be sent to www.macmillan.com after 2 seconds.
          It can also be done with client-side scripting like JavaScript, using the window object like this:
          <script  language=  “JavaScript”>
          <!—
          Window  .location=  ‘anotherpage.html’;
          //—  >
          </script>
          the response object offers another way i.e.

          Response.Redirect

          Response.Redirect URL takes the user to the page URL. If it is within the same site, a relative URL
          (such as “products/index.html”) will work. If it is a separate site, the full address including
          http:// should be provided.




             Notes  Response.Redirect =URL is equivalent to Response.Redirect URL.

          Self Assessment

          Fill in the blanks:
          10.  ……………….. sends a redirect message to the browser, causing it to attempt to connect to
               a different URL.
          11.  ……………….. sends buffered output immediately.
          12.  ……………….. stops processing the .asp file and returns the current result.
          13.  ……………….. erases any buffered HTML output.

          10.4 Cookies

          Cookies are a way for you to store nuggets of information on the visitor’s computer. You can
          then use your code to retrieve the values stored on the visitor’s system at a later time.


                 Example: You could store the most recent searches a visitor has made on your website in
          a cookie. Then, when visitors search again, we could present them with their last five search
          criteria, or you could store visitor’s location in a cookie and when they return to your site, you
          could display local information for your visitors.
          But  since the data are on the visitor’s system, you cannot  use cookies  as your  only way to
          identify visitors or in situations where the cookie must be present. You should always try to
          provide an alternative to cookies.



                                           LOVELY PROFESSIONAL UNIVERSITY                                   247
   248   249   250   251   252   253   254   255   256   257   258