ASP 101 - Active Server Pages 101 - Web04
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

Visual Studio 2008's Multi-Targeting Support
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Make Your Scripts Filename Independent

How often have you renamed an asp script only to find it references itself and because of the rename no longer works. This is often the case with self-referenceing forms and can get really annoying.

So instead of typing the script's name into a form's action attribute, try using a variable from the ServerVariables collection. Specifically, try path_info, script_name, or url. I tend to use script name because it manes the most logical sense to me.

So instead of:

<form action="filename.asp">

which will break when you rename the file, try:

<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>">

When you do something simple like rename a script, there's really no reason it shouldn't post back to the new name automatically. Sometimes it's the simple things (like not having to get involved) that can really make your day.

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers