devxlogo

Create a Link to the Previous Page Using ASP

Create a Link to the Previous Page Using ASP

With pages that are generated dynamically, you can’t provide a hardcoded link back to the previous page. However, ASP often provides you with the name of the page that contained the jump to the current page. With Request.ServerVariables(“HTTP_REFERER”) you can create the link on the fly. Keep in mind that you may not always get a value for the referrer page. Protect yourself by checking for an empty string before displaying the link text. This code shows one way of displaying the Back link if the information is available.

 "" then%>">Back

Notice that the “REFERER” part of the parameter is misspelled. In fact, you must misspell it to make the function work.

devx-admin

Share the Post: