ASP, how to get the URL of the current page

Source: Internet
Author: User
Tags servervariables

Request. servervariables ("script_name") is obtained on the server
Document. Location. href is obtained from the client

-----------------------------------------------------------------------------

You can construct the URL of the current page as follows:
"Http: //" & request. servervariables ("http_host") & request. servervariables ("path_info ")&"? "& Request. servervariables (" QUERY_STRING ")

After obtaining this string, we are writing "Master/detail table"ProgramAfter multiple operations on the detail Table Page, you can still return to the master table. The query parameters and page numbers are retained. Of course, if the detail list operation is performed in the new window, you don't need to peat it here.

How to implement it? For example, we have a student list, which can be queried by class, age, and other conditions, and are directed to the intermediate page number. We can add:
Response. cookies ("mysite") ("url") = "http: //" & request. servervariables ("http_host") & request. servervariables ("path_info ")&"? "& Request. servervariables (" QUERY_STRING ")

Write the URL of the current page into cookies. After clicking the name to the detail table and editing, updating, or deleting the page, run the following statement:
Response. Redirect (request. Cookies ("mysite") ("url "))

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.