i am using the link of metacharge.com for payment gateway, when i post data
throung IE it give the correct response, but when i use the .net code to post
data the response is not correct.message is some data is missing.
i use the following code:
public class httpClass
{
private string UserName;
private string UserPwd;
private string ProxyServer;
private int ProxyPort;
private string Request;
public httpClass(strin g HttpUserName,
string HttpUserPwd, string HttpProxyServer ,
int HttpProxyPort, string HttpRequest)
{
UserName = HttpUserName;
UserPwd = HttpUserPwd;
ProxyServer = HttpProxyServer ;
ProxyPort = HttpProxyPort;
Request = HttpRequest;
}
/// <summary>
/// This method creates secure/non secure web
/// request based on the parameters passed.
/// </summary>
/// <param name="uri"></param>
/// <param name="collHeade r">This parameter of type
/// NameValueCollec tion may contain any extra header
/// elements to be included in this request </param>
/// <param name="RequestMe thod">Value can POST OR GET</param>
/// <param name="NwCred">I n case of secure request this would be
true</param>
/// <returns></returns>
public virtual HttpWebRequest CreateWebReques t(string uri,
NameValueCollec tion collHeader,
string RequestMethod, bool NwCred)
{
HttpWebRequest webrequest =
(HttpWebRequest ) WebRequest.Crea te(uri);
webrequest.Keep Alive = false;
webrequest.Meth od = RequestMethod;
int iCount = collHeader.Coun t;
string key;
string keyvalue;
for (int i=0; i < iCount; i++)
{
key = collHeader.Keys[i];
keyvalue = collHeader[i];
webrequest.Head ers.Add(key, keyvalue);
}
webrequest.Cont entType = "text/html";
//"applicatio n/x-www-form-urlencoded";
if (ProxyServer.Le ngth 0)
{
webrequest.Prox y = new
WebProxy(ProxyS erver,ProxyPort );
}
webrequest.Allo wAutoRedirect = false;
if (NwCred)
{
CredentialCache wrCache =
new CredentialCache ();
wrCache.Add(new Uri(uri),"Basic ",
new NetworkCredenti al(UserName,Use rPwd));
webrequest.Cred entials = wrCache;
}
//Remove collection elements
collHeader.Clea r();
return webrequest;
}//End of secure CreateWebReques t
/// <summary>
/// This method retreives redirected URL from
/// response header and also passes back
/// any cookie (if there is any)
/// </summary>
/// <param name="webrespon se"></param>
/// <param name="Cookie"></param>
/// <returns></returns>
public virtual string GetRedirectURL( HttpWebResponse
webresponse, ref string Cookie)
{
string uri="";
WebHeaderCollec tion headers = webresponse.Hea ders;
if ((webresponse.S tatusCode == HttpStatusCode. Found) ||
(webresponse.St atusCode == HttpStatusCode. Redirect) ||
(webresponse.St atusCode == HttpStatusCode. Moved) ||
(webresponse.St atusCode == HttpStatusCode. MovedPermanentl y))
{
// Get redirected uri
uri = headers["Location"] ;
uri = uri.Trim();
}
//Check for any cookies
if (headers["Set-Cookie"] != null)
{
Cookie = headers["Set-Cookie"];
}
// string StartURI = "http:/";
// if (uri.Length 0 && uri.StartsWith( StartURI)==fals e)
// {
// uri = StartURI + uri;
// }
return uri;
}//End of GetRedirectURL method
public virtual string GetFinalRespons e(string ReUri,
string Cookie, string RequestMethod, bool NwCred)
{
NameValueCollec tion collHeader =
new NameValueCollec tion();
if (Cookie.Length 0)
{
collHeader.Add( "Cookie",Cookie );
}
HttpWebRequest webrequest =
CreateWebReques t(ReUri,collHea der,
RequestMethod, NwCred);
BuildReqStream( ref webrequest);
HttpWebResponse webresponse;
webresponse = (HttpWebRespons e)webrequest.Ge tResponse();
Encoding enc = System.Text.Enc oding.GetEncodi ng(1252);
StreamReader loResponseStrea m = new
StreamReader(we bresponse.GetRe sponseStream(), enc);
string Response = loResponseStrea m.ReadToEnd();
loResponseStrea m.Close();
webresponse.Clo se();
return Response;
}
private void BuildReqStream( ref HttpWebRequest webrequest)
//This method build the request stream for WebRequest
{
Stream oStreamOut= webrequest.GetR equestStream();
byte[] byteArray = Encoding.UTF8.G etBytes(Request );
oStreamOut.Writ e(byteArray,0,R equest.Length);
oStreamOut.Clos e();
}
}
}//End of HttpBaseClass class
please help me. 0 1196 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: 11abacus |
last post by:
Hi,
Just wondering if any of you has thought about or is working on a
payment gateway abstraction layer (PEAR-style)?
I'm interested on developing that or at least start a discussion about
it.
The package would provide a framework for all types of online (and
offline?) payment transactions.
|
by: Peter Afonin |
last post by:
Hello,
I'm struggling with the string conversion to MD5 which I've never user
before.
I have a string that I need to encode which looks approximately like this:
"pva:0.05:101214:pa7735tH:inv_desc=205308:shp_Email=petera_gudzon.net:lang
=ru:shp_PaymentNo=20040825205308:shp_UserID=pva:shp_Price=2.95:shp_HostPlan=
BU:shp_Term=2"
|
by: Andy |
last post by:
Hi,
I'm currently developing my B2C application using ASP.NET. I have several
questions regarding planning this application:
In my application, I'll use my own shopping cart (developed totally in
ASP.NET / MS SQL Server for the backend).
I'm planning to accepting online payment using major credit cards
(Visa/Mastercard), and for that matter I'm currently considering to use
service from ikobo.com.
|
by: japslam japslam via DotNetMonster.com |
last post by:
Hi all,
I have problem when I use HttpWebRequest and take long time to call to my
service server. If at that time there are many request comes in
semultaneous, I will get this exception
System.Net.WebException: The underlying connection was closed: The request
was canceled. ---> System.IO.IOException: Unable to read data from the
transport connection. ---> System.ObjectDisposedException: Cannot access a
disposed object named...
|
by: Neven Klofutar |
last post by:
Hi,
I might need to implement shoping card with full support for Credit card
payment.
Can you recommend a secure payment gateway I could use for this ?
thanx, Neven
| |
by: shantibhushan |
last post by:
Hi
I am facing specific problem with firefox browser. I have integrated payment gateway in my website. it is working fine in internet explorer. But I am facing problem with firefox and opera browser. I have some values in session like client id, client name. when I redirect from payment gateway to own site(e.g. thankyou page) I want to access all session variable. It works fine in IE but in other browser session value destroy. it works in...
|
by: =?Utf-8?B?QXNoZmFx?= |
last post by:
I wanank now how u enable a payment gateway for credit card confirmation from
aspx page we make in shopping cart sites
|
by: sachindhake |
last post by:
Hey Friends,
I am developing a ASP.Net web application for one of our clients, which requires WorldPay payment integration.
I have gone through the documentation, guides available on WorldPay support website, but still have some confusion,
as how to integrate the payment gateway in my web application using C#.
I have few question, any help would be appreciated:
|
by: vinodkus |
last post by:
dear sir/madam
Please tell me how to do payment gateway in asp .
please provide me coding or refer me any site so that I can understood
it easily. I have to do it with ICICI bank. I have been provided a
link for it but i dont know how to implent it.
Please help me
Thanks in Advance
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |