HandleSpecialURL from PayPal

I am able to successfully return from PayPal to my app. The following is the code under my HandleSpecialURL event handler:

if Request.Path = “cancel” then
return true
end if

if Request.Path = “success” then
return true
end if

How do I retrieve I redirect to a specific page of my app?

The last line should read:

“How do I redirect to a specific webpage of my app?”

I have had this same question posted in one form or another for a few days.

Let me explain. The user leaves my app so that they can go to PayPal. Once they return, depending upon whether or not their PayPal was successful, combined with the information from their cookie determines the outcome.

The code from my first post shows where I am at in my app. Any attempts to leave this event handler either crashes my app or is ignored.

I am becoming concerned from the lack of response that either this is not possible, or I am taking the wrong tack.

Any ideas?

Before leaving the app to call PP you have to serialize your session (at least the data you need to rebuild your user experience) and save these data with the sessionID as key (you could use a in memorydb so you can set a TTL)

When you call a page then webApp create a new session, you have to check the cookie (or a parameter), find the record, if it is in the time frame defined (the TTL field) rebuild the session data then redirect the user showing the right page.

I have saved the relevant information to retrieve the customer’s data in a cookie. Do I need to serialize my session in order to get past the HandleSpecialURL event handler and return the customer to my app?

Don’t use HandleSpecialURL. Return to a real page and reload the info from the cookie there.


How do I get the return information from PayPal then? I need to know whether the customer paid or not.

You absolutely CAN use HandleSpecialURL. What you’ll want to do is grab the info from the cookie to identify the user and the info from the Paypal callback and store the success/fail state in your database and then redirect the user back to your app. If the cookie is set, you know that the user was previously logged in, so you check the database for success/fail and take them back to the appropriate page.


I have returned from PayPal, and return successfully to a blank screen. Any code I try to put in the HandleSpecialURL event handler is either ignored our causes the app to crash. How do I redirect to a different webpage?

Ah… you need to set the Location header and set the redirect status value… something like this:

Request.Header("Location") = App.URL Request.Status = 302 Return True

Great! That is progress. Now, I would like to get to a particular page of my app, rather than my start page. Is this done with Session.PageWithName? I cannot find where/how in the Language Reference to set the PageName.

It seems whenever I get to asking the above question in one form or another, my forum posts seem to develop the plague and everybody ignores them. Is it that what I am asking can not be done, or am I asking a stupid question? How do I redirect to a specific page in my app. I have tried several things and none work.

You might want to check out the HashTagChanged event on the WebSession. When a URL is passed to your app like: http://example.com/#myhashtag then you can check the value of HashTag and go to another page, or do whatever else you want your app to do.


Ok, so for several weeks I tried to send a # back to my site from PayPal at the recommendation of various posters. I could not get it to work and then discovered that a hashtag is not a valid character in PayPal’s world.

So, is there a way to send a hashtag to my own app, from within my own app? Also, please see Greg O’Lones final post in this particular forum.


So then do it like this:

Request.Header("Location") = App.URL + "#yourHashTag" Request.Status = 302 Return True
Sorry I haven’t been responding as of late, but life’s been getting in the way.

OK Greg. Sorry it has taken me so long to get back. Different projects in different languages.

So how do I set up this hashtag so that when the user returns to the website it knows where to go? For example I have 8 different webpages. How do I define a webpage and its associated #Hashtag? In other words, I return to my site and want the user to be automatically returned to webpage6. How do I set up the hashtag?