Solved

Receive HTTP POST requests

Posted on 2014-10-01
7
263 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
[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
  • 2
  • 2
7 Comments
 
LVL 28

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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 28

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

623 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