PayPalPDTHandler.aspx not redirecting

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
11/8/2010 11:26:03 AM
Gravatar
Total Posts 25

PayPalPDTHandler.aspx not redirecting

Hello,

I need some help. I have followed the paypal standard info for setting up the ecommerce site and store. I can successfully purchase my product via checkout and on to paypal's site. However, after purchase on paypal, the link to return to my site is just sitting on paypalPDTHandler.aspx. Is this expected behavior? I would expect to be redirected to an order confirmation page.

Details:
I am using it on a multiple site setup where the child site (/Data/Sites/2) is the one with the store and (/Data/Sites/1) has no items to buy as it is my brochure site.

I followed instructions for setup at: http://www.mojoportal.com/using-paypal-standard.aspx

My return URL is: http://www.lazy-admin.com/Services/PayPalPDTHandler.aspx. It did look like there were querystring parameters in the URL but it just sat on the page instead of redirecting to a confirmation page.

Thanks,

Scott

 

11/8/2010 12:13:29 PM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Hi Scott,

Without seeing the actual url parameters it is hard to know for sure, but I can say that there have been a few orders in my store recently where it seems like there has been some glitch at paypal where the query string params were duplicated in the url ie the same params included 2 times and this causes it to not obtain the parameters correctly because the result is like an array for each parameter rather than the expected single value.

Most orders have come through fine, but one or two times in the last week this happened. To me it seems like a bug at PayPal.

Luckily if you also setup IPN (Instant Payment Notification) the notification of payment is redundant so it still sends the user an email with the link to the order. 

Best,

Joe

11/8/2010 2:20:13 PM
Gravatar
Total Posts 25

Re: PayPalPDTHandler.aspx not redirecting

Well the issue for me is that I need to handle the return confirmation so that I can generate some keys based on the successful purchase of the order. In my case, they could order 1 or many sets of keys.

What is the best way to handle that? Modify the PayPalPDTHandler.aspx page and then redirect to my own confirmation page? I need to be able to iterate through the orders and I need to make sure that the payment was actually made and not canceled.

Thanks,

Scott

11/9/2010 6:28:06 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Hi Scott,

your question has now changed to a developer question not a question about site administration.

If you are a skilled ASP.NET developer and able to work with the source code in Visual Studio 2010 and produce your own builds, then you could ask this question in the developer forum and I can at least give you an idea of one way to try and accomplish your goal without forking mojoPortal code.

Best,

Joe

11/9/2010 8:41:46 PM
Gravatar
Total Posts 25

Re: PayPalPDTHandler.aspx not redirecting

Here is the URL....2nd straight time it is blank. Though I had a friend try it and it correctly took him to the confirmation page.

 

https://www.lazy-admin.com/Services/PayPalPDTHandler.aspx?tx=9K579114XU325245S&st=Completed&amt=9.90&cc=USD&cm=3c58cf8e%2d09e3%2d44af%2dae46%2d3ffb7f682820&item_number=&tx=9K579114XU325245S&st=Completed&amt=9.90&cc=USD&cm=3c58cf8e%2d09e3%2d44af%2dae46%2d3ffb7f682820&item_number=

 

Does this tell you why it's not redirecting correctly? I will start a thread on best way to make modifications to paypal page after I resolve this.

11/10/2010 9:07:10 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Hi Scott,

Yes, although it is clipped here in the forums, it was clear in the email notification that the url has duplicated parameters, so it is the same problem I mentioned and seems to be a bug on the paypal side of things since they are redirecting with this url.

If you look closely (not here since it is clipped and not visible but at your original url that you posted) you will see that the parameters are all included twice in the url.

From a little googling, it seems this problem has happened in the past with paypal as well.

http://paypaldev.org/yaf_postst13645_PDT-Duplicate-Return-URL-Variables.aspx

and

https://www.x.com/thread/35699

So it seems like an old paypal bug has resurfaced.

Best,

Joe

11/10/2010 9:16:16 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Actually, I'm going to add handling for this since it can be mitigated and it seems in the past this problem was not resolved quickly by PayPal. There was some sample code in the second link that gave me an idea how to work around it.

Best,

Joe

11/10/2010 9:57:17 AM
Gravatar
Total Posts 25

Re: PayPalPDTHandler.aspx not redirecting

Joe,

You nailed it. It is a paypal issue. I can't believe people were complaining about this back in 2007 and now it's happening again.

If you wouldn't mind, please post your solution to solve this via code or send me an email with your fix. I'm on my on version of the 2.3.5.4 release because I had to get the site up and running asap.

On a different note, I just want to say Thank you! You really have built a great product and I can't believe it's free. You code exactly as I would code (well maybe a little better than I would code it) so it was pretty easy for me to dive in and start making changes as needed. You blow DotNetNuke out of the water in terms of performance and I love how everything you need is pretty much already included without downloading and installing a ton of modules.

I've built 2 sites. My company website and my product website in the span of about a week and a half. Pretty impressive I think.

http://www.ntunedev.com/
http://www.lazy-admin.com/

We will be releasing our product to the new Zune marketplace for windows phone sometime today or tomorrow. If you're interested and you have a new windows phone 7, let me know and I'll give you a free license key.

Thanks,

Scott

11/10/2010 10:16:45 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Hi Scott,

My change is already in the source code repository. Look in the LoadParams method here

http://mojoportal.codeplex.com/SourceControl/changeset/view/584094dd75c3#Web%2fServices%2fPayPalPDTHandler.aspx.cs

Best,

Joe

12/28/2012 7:13:01 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

I am having a similar problem, although it is not parameters being posted twice.  I tried developing my own membership system using the "Subscribe" button hosted by PayPal and the code samples provided by Joe.  Everything seemed to be fine on the PayPal side, but when PayPal redirected back to my site, the PDTHandler page just sat there doing nothing (white page).  I figured I was doing something wrong in code that I couldn't figure out (I have a deadline to get this site done), so I purchased the Site Membership Pro.  Installation went perfect....  I set up my test membership product, and went through the purchase process.  EXACT same thing as with my own code!

This is the url that was showing in my browser (with my test membership product):  mysite.com/Services/PayPalPDTHandler.aspx?tx=5RH12952HH858031W&st=Completed&amt=0.01&cc=USD&cm=ef258316-77f8-4f91-b4c3-e1155563d71e&item_number=


MojoPortal Version: 2.3.9.3 MSSQL
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
ASP.NET Info: Running in Partial Trust
Server Time Zone: Central Standard Time
Server Local Time: (GMT -6) 12/28/2012 7:07:19 AM
Greenwich Mean Time: (GMT/UTC)12/28/2012 1:07:19 PM

sts-SiteMembership: 1.0.0.7

I have gone over and over the code to try and see what was going on, but I have absolutely no clue.  I have no idea what PayPal is supposed to be sending to the PDTHandler, and trying to find info on their site is painful.  Any ideas, guys?
 

 

12/28/2012 7:29:53 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Are you seeing any clues in the mojoPortal log under Administration > System Log?

Note that Site Membership Pro does not currently support recurring payments, so if there is something configured in your paypal account to do something with recurring payments Site Membership Pro is not currently built to handle that if PayPal is sending some kind of different information back. It currnetly handles only single payments and it can send reminders to renew membership.

Basically the way the PDT and IPN handler works is that the order is serialized into the mp_PayPalLog table and the log guid is passed to PayPal. Then when paypal posts back it includes the log guid so we can lookup the log row which also has data about which provider (ie feature) should process the transaction and then it loads that provider and passes in the data. The PDT Handler must also be defined in a file in the /Setup/ProviderConfig/paypalpdthandlers folder, there should be a file in ther corresponding to Site Membership Pro, that file is what it uses to load the provider listed in the log table.

12/28/2012 7:58:53 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

My system log has never shown anything other than entries like this:

2012-12-28 07:14:38,084 INFO 2012-12-28 07:14:38,115 INFO 2012-12-28 07:14:38,115 INFO 2012-12-28 07:14:38,225 INFO 2012-12-28 07:14:43,475 INFO 2012-12-28 07:14:55,538 INFO 2012-12-28 07:14:55,632 INFO 2012-12-28 07:14:55,679 INFO 2012-12-28 07:14:55,679 INFO 2012-12-28 07:14:55,679 INFO 2012-12-28 07:14:55,694 INFO 2012-12-28 07:14:55,694 INFO 2012-12-28 07:14:55,694 INFO 2012-12-28 07:14:55,710 INFO 2012-12-28 07:14:55,710 INFO 2012-12-28 07:14:55,725 INFO 2012-12-28 07:14:55,725 INFO 2012-12-28 07:14:55,725 INFO 2012-12-28 07:14:55,960 INFO 2012-12-28 07:14:56,069 INFO 2012-12-28 07:14:59,288 INFO 2012-12-28 07:15:08,304 INFO 2012-12-28 07:15:08,304 INFO 2012-12-28 07:15:58,837

I am not working with recurring payments with Site Membership Pro.

The table mp_PayPalLog has entries for every single transaction that I attempted, so the PDTHandler is successfully writing to the database.  

There are 3 config files located in the '/Setup/ProviderConfig/paypalpdthandlers' folder: 000_placeholder.config, sts-memberpro-paypalpdthandler.config, and webstorepaypalpdthandler.config.

mp_PayPalLog shows that Provider used was the WebStorePayPalHandler.

Here is the entry for the SerializedObject column:

<?xml version="1.0" encoding="utf-16"?>

<Cart>

   <CartGuid>16f85999-7536-4c5e-bf77-b041717e3750</CartGuid>

  <StoreGuid>db83de6e-6ac6-43a7-b62f-32328e7f23d5</StoreGuid>

  <ClerkGuid>00000000-0000-0000-0000-000000000000</ClerkGuid>

  <CartOffers>

    <CartOffer>

      <ItemGuid>908a79d0-d167-44a6-8838-8b404e5a1e3c</ItemGuid>

      <CartGuid>16f85999-7536-4c5e-bf77-b041717e3750</CartGuid>

      <OfferGuid>cd6a4364-c78f-4a0c-a2ae-5f1d7a1c5423</OfferGuid>

      <TaxClassGuid>6d9569a6-614a-4da9-bb41-e2abd7144742</TaxClassGuid>

      <OfferPrice>0.0100</OfferPrice>

      <Tax>0.0000</Tax>

      <AddedToCart>2012-12-28T01:18:28.323</AddedToCart>

      <Quantity>1</Quantity>

      <IsDonation>false</IsDonation>

    </CartOffer>

  </CartOffers>

  <SerializedCartOffers> &lt;ArrayOfAnyType&gt; &lt;anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d2p1:type="q1:string" xmlns:d2p1="http://www.w3.org/2001/XMLSchema-instance"&gt; &amp;lt;CartOffer&amp;gt; &amp;lt;ItemGuid&amp;gt;908a79d0-d167-44a6-8838-8b404e5a1e3c&amp;lt;/ItemGuid&amp;gt; &amp;lt;CartGuid&amp;gt;16f85999-7536-4c5e-bf77-b041717e3750&amp;lt;/CartGuid&amp;gt; &amp;lt;OfferGuid&amp;gt;cd6a4364-c78f-4a0c-a2ae-5f1d7a1c5423&amp;lt;/OfferGuid&amp;gt; &amp;lt;TaxClassGuid&amp;gt;6d9569a6-614a-4da9-bb41-e2abd7144742&amp;lt;/TaxClassGuid&amp;gt; &amp;lt;OfferPrice&amp;gt;0.0100&amp;lt;/OfferPrice&amp;gt; &amp;lt;Tax&amp;gt;0.0000&amp;lt;/Tax&amp;gt; &amp;lt;AddedToCart&amp;gt;2012-12-28T01:18:28.323&amp;lt;/AddedToCart&amp;gt; &amp;lt;Quantity&amp;gt;1&amp;lt;/Quantity&amp;gt; &amp;lt;IsDonation&amp;gt;false&amp;lt;/IsDonation&amp;gt; &amp;lt;/CartOffer&amp;gt;&lt;/anyType&gt; &lt;/ArrayOfAnyType&gt;</SerializedCartOffers> 

  <UserGuid>8389160e-1edb-4dbd-a39e-57774582acf3</UserGuid>

  <SubTotal>0.0100</SubTotal>

  <ShippingTotal>0.0000</ShippingTotal>

  <TaxTotal>0.0000</TaxTotal>

  <Discount>0.0000</Discount>

  <OrderTotal>0.0100</OrderTotal>

  <Created>2012-12-28T01:18:28.247</Created> 

  <CreatedFromIP>68.98.29.78</CreatedFromIP>

  <LastModified>2012-12-28T01:18:28.48</LastModified>

  <LastUserActivity>2012-12-28T01:18:28.247</LastUserActivity>

  <DiscountCodesCsv /> <CustomData />

</Cart>

 

So, it looks like the issue does not reside with the PDTHandler, but with the '/WebStore/OrderDetail.aspx' page, since I assume that is where the PDT handler is supposed to redirect.  Right?

12/28/2012 8:10:58 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Rows are created in the mp_PayPal log before sending the user to PayPal so those rows don't mean pdt handler is posting correctly, though when it does post if it finds the row it will update the rawresponse field with the post details. There should be rows in there with the site membership provider, rows with webstore provider are created in WebStore.

What version of mojoPortal are you using? It looks like your mojoPortal log4net log is truncating, but the latest version of mojoPortal has a newer version of log4net so I thought that problem should not happen anymore though it can be solved by configuration, possibly configuring it to log to the database may help as well.

12/28/2012 8:37:47 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

Using your configuration link, I solved the log4net issue.  However, in the table 'mp_PayPalLog', the rawresponse column is blank for all transactions.  If there should be rows using the site membership provider, then it looks as if those two attempts never posted anything to the database.

 

As stated before, here are my installation details:

MojoPortal Version: 2.3.9.3 MSSQL
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
ASP.NET Info: Running in Partial Trust
Server Time Zone: Central Standard Time
Server Local Time: (GMT -6) 12/28/2012 7:07:19 AM
Greenwich Mean Time: (GMT/UTC)12/28/2012 1:07:19 PM

12/28/2012 9:05:05 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Now that you log is working do you see any clues when you try a transaction?

From your previous post: &cm=ef258316-77f8-4f91-b4c3-e1155563d71 corresponds to the RowGuid in the mp_PayPalLog table, it should lookup that row find that it has the site membership provider and call that provider to handle the request, that provider will redirect to /smp/OrderDetail.aspx upon a successful order received and processed.

Is WebStore working for you with PayPal? Do PayPal transactions in WebStore work correctly?

Have you configured the required settings in user.config for pdt?

You should also have IPN configured so that paypal can post the order even if the user does not return to your site via pdt

12/28/2012 9:15:47 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

Before I try another sample transaction, I noticed something interesting.  I saw some info messages appearing in the system log.  I decided to look at the tasks queue and I found this:

Task Queue History

  Task Name Queued Started Last Update Completed Progress
     WebTaskManager 12/28/2012 7:28 AM 12/28/2012 7:28 AM 12/28/2012 8:11 AM 1/1/0001 12:00 AM 50%
     WebTaskManager 12/28/2012 7:23 AM 12/28/2012 7:23 AM 12/28/2012 7:28 AM 12/28/2012 7:28 AM 100%
     Site Membership Management Task 12/28/2012 4:40 AM 12/28/2012 8:06 AM 12/28/2012 8:07 AM 1/1/0001 12:00 AM 50%

There are two running tasks that are only 50% complete.  One of these is for Site Membership Management.  1. What task is this? and 2. Can I safely delete/abandon it before running a test membership purchase?

12/28/2012 9:23:17 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

All my PayPal settings are correct.  I touched the web.config (there are no paypal settings in user.config), and then looked at the System Log.  Does this look normal?

2012-12-28 09:19:38,046 INFO mojoPortal.Web.Global - Application Started. 
2012-12-28 09:19:38,061 ERROR mojoPortal.Web.Global - Application_Start Could not register VirtualPathProvider, this error is expected when running in Medium trust or lower 
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at mojoPortal.Web.Global.RegisterVirtualPathProvider()
   at mojoPortal.Web.Global.Application_Start(Object sender, EventArgs e)
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Web.AspNetHostingPermission
The Zone of the assembly that failed was:
MyComputer
2012-12-28 09:19:39,483 INFO mojoPortal.Web.WebTaskManager - deserialized WebTaskManager task 
2012-12-28 09:19:39,483 INFO mojoPortal.Web.WebTaskManager - Queued WebTaskManager on a new thread 

 

12/28/2012 9:51:25 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

Okay, so here are the results of the System Log after running another test transaction:

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 23.63.210.234:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at mojoPortal.Business.WebHelpers.PaymentGateway.PayPalStandardPaymentGateway.ValidateIPN()
   at mojoPortal.Web.Services.PayPalIPNHandler.Verify(String ipnForm)
   at mojoPortal.Web.Services.PayPalIPNHandler.HandleRequest()
2012-12-28 09:47:13,362 ERROR mojoPortal.Web.Services.PayPalPDTHandler - System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 23.63.210.234:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at mojoPortal.Business.WebHelpers.PaymentGateway.PayPalStandardPaymentGateway.ValidatePDT()
   at mojoPortal.Web.Services.PayPalPDTHandler.Verify(String transactionId)
   at mojoPortal.Web.Services.PayPalPDTHandler.HandleRequest() 

 

It's not a problem on my end.  Looks like PayPal server isn't responding.

 

12/28/2012 12:02:45 PM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Is there anything about your network environment that would prevent your web server from making a server side web request to paypal?

Maybe there is a firewall preventing outbound requests from the server side code. I doubt if the problem is on the paypal side.

Once paypal posts to your pdt or ipn the server must then post back to paypal to verify and get the details of the transaction and that is where it is failing.

12/28/2012 12:15:55 PM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

You may need to check with your web host because the medium trust settings may be preventing server side web requests.

For example in Web.config we can force medium trust by adding this:

<trust level="Medium" originUrl=".*" />

which we use for testing medium trust but it requires that originUrl setting .* in order for server side web requests to work.

Note that we can force more restrictive trust from web.config but we cannot make it less restrictive from there, ie you can't change it to full trust from web.config if it is set for medium trust in machine.config.

So your host would need to add the orginUrl setting in machine.config to allow outbound server side web requests, or you may need to migrate to less restrictive hosting.

12/30/2012 12:46:30 AM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

Joe,
After a lot of arguing with the supposed "technical" support for my web hosting, they finally provided a solution.  I am sharing here just in case anyone else experiences the same issue.
Use the following in web.config to establish a connection to the proxy server:

<system.net>

  <defaultProxy>

    <proxy usesystemdefault = "False" bypassonlocal="False" proxyaddress="http://myproxyaddress:port" />

  </defaultProxy>

</system.net>

The bold, italic proxy address needs to be set to the appropriate proxy server address for your hosting company.  Also, Visual Studio (2010 is the version I am using) complains if the False boolean starts with a lower case letter.
 

1/2/2013 11:39:15 AM
Gravatar
Total Posts 18439

Re: PayPalPDTHandler.aspx not redirecting

Thanks for that update! I've added some notes about that to the PayPal documentation to make it easier to find if someone else encounters similar issues with their host.

Best,

Joe

1/3/2013 4:18:19 PM
Gravatar
Total Posts 13

Re: PayPalPDTHandler.aspx not redirecting

Thanks, Joe!

You must sign in to post in the forums. This thread is closed to new posts.