• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Receive HTTP POST requests

I need to receive HTTP POST requests, I thought I had it working but it turns out I was receiving GET instead of post. I have no experience in this and I am on quite a tight deadline.

What is the easiest way for me to get the posted data in to a text file? I was using a simple ASP code in IIS for the GET.


<%
Dim TN,FN,SN,RF, stext

Dim fs, file

fs=Server.CreateObject("Scripting.FileSystemObject")
file=fs.CreateTextFile("C:\approvedindex\upload\" & request.querystring("Reference") & ".txt",true)

TN = request.querystring("TradingName")
FN = request.querystring("firstname")
SN = request.querystring("surname")
RF = request.querystring("Reference")

file.write(TN)
file.write(",")
file.write(FN)
file.write(",")
file.write(SN)
file.write(",")
file.write(RF)


file.close
file=nothing
fs=nothing
 %>
Post Completed

Open in new window

0
CaptainGiblets
Asked:
CaptainGiblets
  • 3
  • 2
  • 2
2 Solutions
 
Dan McFaddenSystems EngineerCommented:
Request.Querystring is accessing data from a HTTP GET.  You want to use Request.Form, Microsoft reference link:

http://msdn.microsoft.com/en-us/library/ms525985(v=vs.90).aspx

Just need to replace Request.Querystring  with Request.Form in the script.  This all assumes that the action is actually a HTTP POST.  If the inbound HTTP request is using a URL with querystrings, the Form collection will not work.

Dan
0
 
Dave BaldwinFixer of ProblemsCommented:
If it's POST, it should be 'Request.Form' instead of 'request.querystring'.  More info here: http://www.w3schools.com/asp/asp_inputforms.asp
0
 
CaptainGibletsAuthor Commented:
So if I just update anything that says request.QueryString to request.form it should work the way it is?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Dan McFaddenSystems EngineerCommented:
Yes.  Provided that the HTTP request is really arriving at the server as a POST.
0
 
Dave BaldwinFixer of ProblemsCommented:
Most likely, I don't see any reason it shouldn't.
0
 
CaptainGibletsAuthor Commented:
Great, updated the file and made a sample form post and it works. I will split between you as you have both been helpful.
0
 
Dave BaldwinFixer of ProblemsCommented:
Thanks.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now