?
Solved

How to detect calling Form submission in ASP

Posted on 2008-10-17
3
Medium Priority
?
382 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

719 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