Unable to post to paypal using HttpWebRequest in

Posted on 2006-04-04
Last Modified: 2012-05-05
I am trying to post information to paypal in order for customers to pay for merchandise on a site that I am developing. I am passing the information over so the paypal site can grab the info. I am using the HttpWebRequest and what is happening is that it is not redirecting to the paypal site. Here is the code that I am using.

Protected Sub lbAddress_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbAddress.Click

        Dim objRequest As HttpWebRequest
        Dim strRequest As String
        Dim arrRequest As Byte()
        Dim objUTF8Encoding As UTF8Encoding
        Dim strmRequest As Stream

        objRequest = CType(WebRequest.Create(""), HttpWebRequest)
        objRequest.Method = "POST"
        objRequest.ContentType = "application/x-www-form-urlencoded"

        strRequest = "?" & Server.UrlEncode("cmd=_cart &upload=1 & &amount_1=10.00")
        objUTF8Encoding = New UTF8Encoding
        arrRequest = objUTF8Encoding.GetBytes(strRequest)
        objRequest.ContentLength = arrRequest.Length
        strmRequest = objRequest.GetRequestStream()
        strmRequest.Write(arrRequest, 0, arrRequest.Length)

    End Sub

I have been trying to get this to work for a couple hours now and am totally stumped.

Question by:ryapos
    1 Comment
    LVL 6

    Accepted Solution

    I'm not sure if it helps, but I found a detailed code sample here...

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now