- Classic ASP
- Forms
- How to get the file name from the URL and use it to display different data
How to get the file name from the URL and use it to display different data
Article Entry Date: February 20,2024 @ 09:32:41 / Last Updated On: February 20,2024 @ 11:09:45
How do I get the name of an ASP Classic file with its extension to see what page I am editing?
Using this simple script, you can find out what page.asp you are working on.
This is handy when testing pages before adding code to a live site.
The above is just an example. To use this in a real-world scenario, we will do something like this.
Below, we are changing the file name in our live code from the test.asp page to the default.asp page.
This way, we can run our test on the test page and then move our code over to the live page and test it out.
When you load the test.asp page. This will trigger the code to load the appropriate file name in the page links. This will enable you to click on links throughout the site without worrying about having the page load the default.asp page.
Scenarios like this are what we use in our development. Though we have not used this method before, we have started doing it to make it easier to develop our site when working with the rewrite rules.