Solved

How to detect calling Form submission in ASP

Posted on 2008-10-17
3
335 Views
Last Modified: 2010-05-18
Hi Experts,

I know I'm going to kick myself on this, but I'm having to switch back to ASP for the first time in ages and can't for the life of me remember how to detect in ASP which file, (HTML), has called another script, (ASP), with a form post.

The story is that there are a bunch of HTML forms in different directories and with different file names that all submit a form to the same capture_enquiry.asp script in the root of the site.  I'd like to be able to tell, in the capture_enquiry.asp script, which form/path+filename has been submitted in each instance and act accordingly depending on which form has been submitted.

I know I could do this by changing the form name in each of the HTML pages but that would mean modifying every one of the forms and there are about 30 of them so I'd rather just be able to detect the form submitted if possible?

Many thanks,
0
Comment
Question by:jammy-d0dger
3 Comments
 
LVL 11

Accepted Solution

by:
flipz earned 250 total points
Comment Utility
Request.ServerVariables("HTTP_REFERER") should do the trick. It should provide the full URL of the page submitting the request so you may have to parse out the exact page. Tested using a form GET - not sure about a POST but I wouldn't assume any difference.
0
 
LVL 9

Assisted Solution

by:deathtospam
deathtospam earned 250 total points
Comment Utility
However using HTTP_REFERER isn't 100% reliable -- there are some browsers and versions that don't pass it along ( http://tinyurl.com/652npo ).

Unfortunately, the most reliable way to do it would probably be to add a hidden variable, unique to each form, to the form.  
0
 

Author Closing Comment

by:jammy-d0dger
Comment Utility
Thanks experts.  Although the tinyurl link didn't work I have looked into it and seen that it does indeed seem that it isn't totally reliable.  But it does work for us here, so both answers are valid and useful.  Thanks very much.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now