Register   Login
     
  Categories  
  Archives  
  Authors  
  Blog  
08

I had an interesting issue today when sorting out an issue with Subscription Tools.

The crux of the issue revolved around a redirect to PayPal for payment. When the redirect is formed a number of parameters are appended to the querystring, including the notification URL for IPN (Instant Payment Notification). This worked great in DNN 3.x (ASP.NET 1.1), but formed a different URL when using DNN 4.x (ASP.NET 2).

The two params that were different were:-

http://www.test.com/ipn.aspx?param=http%3a//test.com/ipnhandler.ashx (ASP.NET 1.1)

and the problem URL:-

http://www.test.com/ipn.aspx?param=http%3a/test.com/ipnhandler.ashx (ASP.NET 2.0)

The issue is that the 2nd URL only has a single / at the http://, I checked some code in the Commerce Starter Kit, but it was identical, and I could only assume the problem was occurring because of ASP.NET 1.1 code running on ASP.NET 2.0.

Originally I thought it was occurring in the encode, but the actual problem occurs in the Response.Redirect, somewhere in that function, the //'s are converted to a single / (I must reflector it). The temporary solution is to create my own redirect method for this page, and here it is:-

Public Sub Redirect(ByVal url As String)

    If (url Is Nothing) Then
        Throw New ArgumentNullException("Url is Nothing!")
    End If

    If (url.IndexOf(ChrW(10)) >= 0) Then
        Throw New ArgumentException("Cannot Redirect To Newline")
    End If

    Response.Clear()

    Response.StatusCode = 302
    Response.RedirectLocation = url

    Response.Write("<html><head><title>Object moved</title></head><body>" & ChrW(13) & ChrW(10))
    Response.Write(("<h2>Object moved to <a href='" & HttpUtility.HtmlEncode(url) & "'>here</a>.</h2>" & ChrW(13) & ChrW(10)))
    Response.Write("</body></html>" & ChrW(13) & ChrW(10))

    Response.End()

End Sub

Post Rating

Comments

ying
# ying
Monday, May 08, 2006 8:40 AM
cool!!!
Mike Mogensen
# Mike Mogensen
Monday, May 22, 2006 9:00 AM
Could this same issue explain the problems with the core mechanism for fee based role subscriptions in 4.0.x ? Paypal processes the payment but then I am redirected to http://http:/www.mysite.com (an extra http:/ - only one slash) The role does not end up being applied to the user. I have this same thing working fine in 3.x but would like to deploy with 4.0.3 Any thoughts would be greatly appreciated!
smcculloch
# smcculloch
Monday, May 22, 2006 5:37 PM
Yep, the code was originally taken from the core code..

Post Comment

Name (required)

Email (required)

Website

Enter the code shown above: