nauna
on Oct 06, 2016 07:17 AM
4552 Views
hi,
i have configured paypal on my server and added these lines to enabl tls requested by paypal in my application
but when i open the page it gives me following error
https://snag.gy/fh587e.jpg
what should i do Please advice
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
ServicePointManager.DefaultConnectionLimit = 9999;
//end of server protocal
//Post back to either sandbox or live
string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
//post of live
string strLive = "https://www.paypal.com/cgi-bin/webscr";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
string strRequest = Encoding.ASCII.GetString(param);
string strResponse_copy = strRequest; //Save a copy of the initial info sent by PayPal
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;
//for proxy
//WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
//req.Proxy = proxy;
//Send the request to PayPal and get the response
StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();
if (strResponse == "VERIFIED")
{
}
Download FREE API for Word, Excel and PDF in ASP.Net:
Download
nauna
on Oct 06, 2016 07:56 AM
2
where should i add this namespace in project? Please guide.
should i add this on my page or some where else?
This namespace already present. You need to select SecurityProtocolType and press F12 you will able to see the enum. Check the availe protocoltype in the system dll and you can use those only in your code.