Solved

How to detect calling Form submission in ASP

Posted on 2008-10-17
3
342 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
ID: 22742564
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
ID: 22745064
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
ID: 31649761
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

9 Experts available now in Live!

Get 1:1 Help Now