473,804 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anyone using PayPal IPN with .NET?

I have code (below) that was working a year ago that I'm trying to use again
and it's now not working. The response is always invalid. Anyone know why?

Code:

Function GetPayPal() As Boolean
Dim myRequest As HttpWebRequest =
CType(HttpWebRe quest.Create("h ttps://www.paypal.com/cgi-bin/webscr"),
HttpWebRequest)
Dim strToSend As String
myRequest.Allow AutoRedirect = False
myRequest.Metho d = "POST"
myRequest.Conte ntType = "applicatio n/x-www-form-urlencoded"

strToSend = Request.Form.To String()
'Create the string to post back to PayPal system to validate
strToSend &= "&cmd=_noti fy-validate"

'Create post stream
Dim RequestStream As Stream = myRequest.GetRe questStream()
Dim SomeBytes() As Byte = Encoding.UTF8.G etBytes(strToSe nd)

RequestStream.W rite(SomeBytes, 0, SomeBytes.Lengt h)
RequestStream.C lose()

'Send request and get response
Dim myResponse As HttpWebResponse = CType(myRequest .GetResponse(),
HttpWebResponse )

If myResponse.Stat usCode = HttpStatusCode. OK Then
'Obtain a 'Stream' object associated with the response object.
Dim ReceiveStream As Stream = myResponse.GetR esponseStream()
Dim encode As Encoding =
System.Text.Enc oding.GetEncodi ng("utf-8")

'Pipe the stream to a higher level stream reader with the
required encoding format.
Dim readStream As StreamReader = New StreamReader(Re ceiveStream,
encode)

'Read result
Dim Result As String = readStream.Read Line()

'For testing purposes
Response.Write( Result)
Response.End()
End If
End Function
Nov 20 '05 #1
1 2050
Hi,

There is a free pay pal control from componentone in the vb.net and
the asp.net resource kits.

http://msdn.microsoft.com/asp.net/asprk/default.aspx
http://msdn.microsoft.com/vbasic/vbrkit/default.aspx
Ken
---------------------
"Greg" <no****@nospam. com> wrote in message
news:uX******** ******@TK2MSFTN GP09.phx.gbl...
I have code (below) that was working a year ago that I'm trying to use
again
and it's now not working. The response is always invalid. Anyone know
why?

Code:

Function GetPayPal() As Boolean
Dim myRequest As HttpWebRequest =
CType(HttpWebRe quest.Create("h ttps://www.paypal.com/cgi-bin/webscr"),
HttpWebRequest)
Dim strToSend As String
myRequest.Allow AutoRedirect = False
myRequest.Metho d = "POST"
myRequest.Conte ntType = "applicatio n/x-www-form-urlencoded"

strToSend = Request.Form.To String()
'Create the string to post back to PayPal system to validate
strToSend &= "&cmd=_noti fy-validate"

'Create post stream
Dim RequestStream As Stream = myRequest.GetRe questStream()
Dim SomeBytes() As Byte = Encoding.UTF8.G etBytes(strToSe nd)

RequestStream.W rite(SomeBytes, 0, SomeBytes.Lengt h)
RequestStream.C lose()

'Send request and get response
Dim myResponse As HttpWebResponse = CType(myRequest .GetResponse(),
HttpWebResponse )

If myResponse.Stat usCode = HttpStatusCode. OK Then
'Obtain a 'Stream' object associated with the response object.
Dim ReceiveStream As Stream = myResponse.GetR esponseStream()
Dim encode As Encoding =
System.Text.Enc oding.GetEncodi ng("utf-8")

'Pipe the stream to a higher level stream reader with the
required encoding format.
Dim readStream As StreamReader = New
StreamReader(Re ceiveStream,
encode)

'Read result
Dim Result As String = readStream.Read Line()

'For testing purposes
Response.Write( Result)
Response.End()
End If
End Function

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3584
by: madison | last post by:
Hi, I am trying to start a website using paypals shopping cart function. If i have 10 items and they sell out, how do I make it so the item is then listed as sold out. The next person would not be able to come along and add it to their shopping cart. thanks joy
5
4776
by: Vinod | last post by:
Hi I am having a payment website which needs to be integrated, i am having the following code which is not working fine. I am having the following script and my notifyurl is not working i don't know why can guys please help me up <% if SIGNUP_PRICE > 0 then
4
8723
by: Roger R. Smith | last post by:
I would like to take some data off an ASP.NET form and then use that data to post a new form to another web site. I was going to use: HttpWebRequest, but I want to be able to post the form and follow the form submission. Any ideas? Thanks, Rog
7
2585
by: Alan Silver | last post by:
Hello, I've just been looking at the free PayPal component from ComponentOne and am somewhat amazed how insecure it is. They include all the transaction details in plain text in the querystring, meaning that any rank novice can click the Buy button on your site, then when the PayPal page loads, change the amount for the transaction and press Enter. This reloads the page with the new amount. This is so obvious that anyone could do it.
0
1566
by: palomine1234 | last post by:
PAYPAL MAGIC!!! TURN $5 INTO $15,000 IN ONLY 30 DAYS...HERES HOW! This is a Money Scheme and Not, I repeat... This is Not a Scam!!!
0
1703
by: micahel | last post by:
Please chat with me by cnbbiz2008@hotmail.com to get the price and more photos, we take supplier paypal as payment. please see the photo album below for our product list. trainers supplier paypal cnbbiz2008@hotmail.com ( http://photo.163.com/photos/xinpaodao.2235855/#p1 ) adidas shoes supplier paypal cnbbiz2008@hotmail.com ( http://photo.163.com/photos/xinpaodao.2235855/#p1 ) adidas sneakers supplier paypal ...
0
1757
by: Nicodemus | last post by:
Do You Belive? \ cheapbbc@sina.com wrote in news:aecf26b6-4c75-4d87-b09c-a7380875e0f3 @w34g2000prm.googlegroups.com:
0
1745
by: micahel | last post by:
Please chat with me by cnbbiz2008@hotmail.com to get the price and more photos, we take supplier paypal as payment. please see the photo album below for our product list. trainers supplier paypal cnbbiz2008@hotmail.com ( http://photo.163.com/photos/xinpaodao.2235855/#p1 ) adidas shoes supplier paypal cnbbiz2008@hotmail.com ( http://photo.163.com/photos/xinpaodao.2235855/#p1 ) adidas sneakers supplier paypal ...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10329
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,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
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...
1
7626
isladogs
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...
0
6858
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();...
0
5527
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...
1
4304
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
3
3000
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.