Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to detect calling Form submission in ASP

Posted on 2008-10-17
3
Medium Priority
?
386 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 1000 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 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

926 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