Solved

Receive HTTP POST requests

Posted on 2014-10-01
7
255 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 26

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 82

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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 26

Expert Comment

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

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 82

Expert Comment

by:Dave Baldwin
ID: 40354133
Thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

760 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

24 Experts available now in Live!

Get 1:1 Help Now