I need to change this script to c# as i am writing an MVC 5 website or any suggestions on how I can write it in C# it basically takes the post data from a rfid reader and pushes it to a web url. Thanks if you can help at all

<?php
   // Uncomment this block for debug.
   // It writes the raw POST data to a file.
   /*
   $fn = "log.txt";
   $fp = fopen($fn, "a");
   $rawPostData = file_get_contents('php://input');
   fwrite($fp, date("l F d, Y, h:i A") . "," . $rawPostData . "\n"); 
   fclose($fp);
   */

   // Define the user name, password,
   // MySQL hostname and database name.
   define("DB_USER", "user");
   define("DB_PASS", "pass");
   define("DB_HOST", "mysql.myhost.com");
   define("DB_NAME", "dbname");

   // Store the POST variables.
   $readerName = $_POST[reader_name];
   $macAddress = $_POST[mac_address];
   $lineEnding = $_POST[line_ending];
   $fieldDelim = $_POST[field_delim];
   $fieldNames = $_POST[field_names];
   $fieldValues = $_POST[field_values];

   // Connect to the database.
   $con = mysql_connect(DB_HOST, DB_USER, DB_PASS);
   mysql_select_db(DB_NAME) or die( "Unable to select database");

   // Replace the field delimiter with a comma.
   str_replace($fieldDelim, ",", $fieldNames);

   // Break the field values up into rows.
   $rows = explode("\n", $fieldValues);

   // Remove the last row. It's always blank
   if (sizeof($rows)) array_pop($rows);

   $fieldNames = "reader_name,mac_address," . $fieldNames;             

   foreach ($rows as $row)
   {
      $row = $readerName . "," . $macAddress . "," .
      $row;
      $query = "INSERT INTO tags ($fieldNames) VALUES ($row)";
      echo $query . "\n";
      mysql_query($query);     
   }         

   mysql_close($con);
?>

Hey you are in the same county as me!

Can you show me your html form or sample post data?

This is the data posted from the reader at set intervals

I havent yet done the html page!.

These are the POST variables sent by Speedway Connect:

reader_name : The name assigned to the reader in Speedway Connect
mac_address : The MAC address of the reader
line_ending : Line ending character specified in Speedway Connect
field_delim : Field delimiter character specified in Speedway Connect
field_names : A list of field names, separated by the specified delimiter
field_values : A list of field values, separated by the specified delimiter