Did you copy this code from another payment plugin ? Here is some code from the commweb payment gateway
// Remove the trailing ampersand on the POST data string string postDataStr = postData.ToString().Substring(0, postData.Length - 1);
// Get the URL of the Virtual Payment Client string vpcURL = _commWeb2PartyPaymentSettings.VpcUrl;
// Perform the VPC request (i.e. HTTPS POST) and obtain the VPC response System.Net.WebClient webClient = new System.Net.WebClient(); webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); byte[] response = webClient.UploadData(vpcURL, "POST", Encoding.ASCII.GetBytes(postDataStr));
// Convert the response to a string from a byte array and parse it to extract // the data using the splitResponse function. Store results in a hashtable. responseData = System.Text.Encoding.ASCII.GetString(response, 0, response.Length); responseDecoded = WebUtility.UrlDecode(responseData); _logger.Information("CommWeb2Party response: " + responseDecoded, null, customer); System.Collections.Hashtable responseParameters = splitResponse(responseData);