• GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Highlighted
    New

    ASP.net, SSL, and Paypal IPN

    Hello all,

     

    I'm experiencing what seems like a problem that other developers might be seeing too.

     

    I use a Paypal buy now button on my ASP.net 4.0 website which works just fine when it come to managing the purchase of my product.  But when I try to use PayPal's IPN protocol to record the purchase I have issues.

     

    Paypal requires a handshake where they send a post and then your website sends back the post with some added text.

     

    My problem is I can't get  my post back to Paypal to complete the handshake.  I've searched a bunch of forums and they all suggest the same code for this handshake.

     

    'Handle SSL protocol

    ServicePointManager.Expect100Continue = True

    ServicePointManager.SecurityProtocol = SecurityProtocolType.TLS12

    ServicePointManager.DefaultConnectionLimit = 9999

     

    dim strLive as string = "https://www.sandbox.paypal.com/cgi-bin/webscr"

     

    dim req as HttpRequest =Ctype(WebRequest.Create(strLive), HttpWebRequest)

     

    'Set Values for the request back

    req.Method = "Post"

    req.ContentType = "application/x-www-form-urlencoded"

    dim Param() as Byte = Request.BinaryRead(HttpContext.Current.ContentLength)

    dim strRequest as String = Encoding.ASCII.Getstring(Param)

    strRequest = strRequest + "&cmd=notify-validate"

     

    'Send Request to Papal and get a response

    dim streamout as StreamWriter = New Streamwriter(req.GetRequestStream(),Encoding.ASCII)

    streamoute.write(strRequest)

    streamout.Close()

     

     

    This is where the code breaks.  The streamout.write doesn't seem to happen.  I verified this using PayPal's IPN history.  They never receive the post back.

     

    Has anyone else seen this problem?  Does anyone have IPN working with ASP.net code?

    I've narrowed it down to the code that sends the post back to Paypal.

     

     I've read that it has something to do with GoDaddy server configuration, but those posts were so old, I doubt they still apply.

     

    Does anyone have any insight or suggestions?

     

     

     

    BWP
    5 REPLIES 5
    Highlighted
    Community Manager
    Community Manager

    Re: ASP.net, SSL, and Paypal IPN

    Hi @BWP

    What were the limitations that the forum posts said might be occurring on GoDaddy's side? Also, what kind of hosting plan is this on? If it's an older Classic or Web Hosting plan, it's possible that the limitations could still be a factor. 

    Hopefully others in the community with ASP.NET experience will have more to add.

     

    JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.
    Highlighted
    New

    Re: ASP.net, SSL, and Paypal IPN

    I'm pretty sure my account was upgraded to the latest hosting.

     

    I'm not certain how to tell though.

    BWP
    Highlighted

    Re: ASP.net, SSL, and Paypal IPN

    I don't think that the Paypal IPN works when using sandbox.

     

    Cheers

    Gary

    Highlighted

    Re: ASP.net, SSL, and Paypal IPN

    Hi BWP,

    Did you manage to solve the issue.

    I am having the same issue and don't know how to fix it.

     

    Thanks.

    Highlighted
    Helper II

    Re: ASP.net, SSL, and Paypal IPN

    Although I'm a computer programmer, I don't have any experience with ASP.net.

    I'm sure this is probably just a typo in your first post here, but I wanted to make sure you knew in the code you shared, you have:

     

    streamoute.write(strRequest)

     

    instead of:

    streamout.Write(strRequest)

     


    Your code has an '
    e' at the end of streamout.   Generally, the programming languages I play around with require the code to be compiled and linked in order to be executed and the compiler will catch errors like this and prevent the object files from being linked.   However, with a language like ASP.net, you don't really have a compiler, right?   So, maybe typographically errors in your code are a bit harder to debug...

    That 'e' at the end of your streamout statement, that's just in your post to the thread and not actually in your source code, right?   Also, in my programming languages, capitalization does matter.   I don't know if it does or not in ASP.net, but your 'w' in the streamout.write statement is not capitalized.   Maybe that needs to be capitalized as well?   I hope this helps.

    Thanks.