Solved

Receive HTTP POST requests

Posted on 2014-10-01
7
258 Views
Last Modified: 2014-10-01
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
Comment
Question by:CaptainGiblets
  • 3
  • 2
  • 2
7 Comments
 
LVL 27

Accepted Solution

by:
Dan McFadden earned 250 total points
ID: 40354100
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
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 40354104
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
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 40354108
So if I just update anything that says request.QueryString to request.form it should work the way it is?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 27

Expert Comment

by:Dan McFadden
ID: 40354114
Yes.  Provided that the HTTP request is really arriving at the server as a POST.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40354115
Most likely, I don't see any reason it shouldn't.
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 40354116
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
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40354133
Thanks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
A few customers have recently asked my thoughts on Password Managers.  As Security is a big part of our industry I was initially very hesitant and sceptical about giving a program all of my secret passwords.  But as I was getting asked about them mo…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

810 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