I've got two scripts on a windows server, setup to receive data from a post.
One is a PHP file that works.
<?php
echo "Hello! <br/> This is a Post Back script that writes to a text file!";
// retrieving information from Post Back
$accounting = $_POST["accountingAmount"];
$accounting_txt = "accounting: " . "$accounting" . "\n\n";
$address1 = $_POST["address1"];
// LOTS MORE FIELDS //
$address1_txt = "address1: " . "$address1" . "\n\n";
"$recurPrice_txt" . "$referer_txt" . "$referringUrl_txt" . "$reservationId_txt" . "$responseDigest_txt" . "$start_date_txt" . "$state_txt" . "$sub_id_txt" . "$typId_txt" . "$username_txt" . "$zipcode_txt";
// write to a text file
$myFile = "postback.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $message;
fwrite($fh, $stringData);
fclose($fh);
?>
The ASP.NET MVC script is this:
[HttpPost]
public ActionResult approved(FormCollection formValues)
{
var context = new LSmixDbEntities();
PaymentHistory ph = new PaymentHistory();
StringBuilder s = new StringBuilder();
foreach (string key in Request.Form.Keys)
{
s.AppendLine(key + ": " + Request.Form[key] + Environment.NewLine);
}
string formData = s.ToString();
//save formData in db
}
I tested by putting vs on the server itself and breakpointing, the action doesn't even start.
Is there any reason a .php file would be hit by a remote postback, but an MVC action wouldn't be?