tags:

views:

51

answers:

1

Hi, I'm working with the SagePay payment gateway.

On a checkout button click I'm using the method below to postData (contains the transaction data) to SagePay who then return the result in the form of a html page.

public string SendRequest(string url, string postData)
{
    var uri = new Uri(url);
    var request = WebRequest.Create(uri);
    var encoding = new UTF8Encoding();
    var requestData = encoding.GetBytes(postData);

    request.ContentType = "application/x-www-form-urlencoded";
    request.Method = "POST";
    request.Timeout = (300 * 1000); //TODO: Move timeout to config
    request.ContentLength = requestData.Length;

    using (var stream = request.GetRequestStream())
    {
        stream.Write(requestData, 0, requestData.Length);
    }

    var response = request.GetResponse();

    string result;

    using (var reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII))
    {
        result = reader.ReadToEnd();
    }

    return result;
}

How do I show this returned html in the users browser window as this would be where they enter their credit card info?

A: 
spender
Its not a windows forms application but a web forms website
N00b