Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
13
Erster Beitrag:
vor 4 Monaten, 2 Wochen
Letzter Beitrag:
vor 4 Monaten, 1 Woche
Beteiligte Autoren:
André Labuschagné, Piet van Zanten, Fabrice Harari, Alexandre Leclerc

WB - AWP Page Woes

Startbeitrag von André Labuschagné am 08.07.2017 00:54

Hi All

So now I sort of know what an AWP Page is and how it is expected to behave.

I am calling an AWP page from a Dynamic Page that is not an AWP page. No matter what I try I cannot go back to the calling page without using the NewBrowser parameter in the DynamicSiteDisplay function. This is not good. It is actually bad - very bad. How can I return to the calling page in the same web app? I do not want a new browser.

Cheers
André

Antworten:

Hi André,

Did you check the option "Allow the access by DynamicSiteDisplay()" on the advanced tab of the page you are trying to return to?

Kind regards,
Piet

von Piet van Zanten - am 08.07.2017 09:23
Hi Piet

Yes - it works when I use the newbrowse parameter. I am trying to work out how to get it to work without opening a new browse.

Cheers
André

von André Labuschagné - am 08.07.2017 12:45
maybe if you show us your code...

von Fabrice Harari - am 08.07.2017 14:54
I have tried:

DynamicSiteDisplay("MySite",Payment,"",CurrentBrowser)

DynamicSiteDisplay("MySite",Payment,"",CurrentFrame)

DynamicSiteDisplay("MySite",Payment,"",ParentFrame)

DynamicSiteDisplay("MySite", Payment, "", NewBrowser, "NEWBRW", ONDimension + ONScrollBar, 500, 400, 0, 0, "dependent=1")

DynamicSiteDisplay("MySite", Payment, "", NewBrowser, "NEWBRW", ONDimension + ONScrollBar, 500, 400, 0, 0, "")

The only two that work is where NewBrowser is the parameter which I do not want. NewBrowser means zero context and I have effectively lost all connection with the original Dynamic Pages. I have no idea why anyone would ever want to do that. It is crazy.

Payment is a Dynamic Page - non *awp* - and it has the "Allow the access by DynamicSiteDisplay()" checked.

I want to go back to that page the context of the page intact so that the user can proceed with other things.

For now this is a show stopper.

von André Labuschagné - am 08.07.2017 16:00
Hi André,

If you want to keep the context, then perhaps you can pass the result of PageAddress() to your awp page.
Then going back from awp open this context again.
Or another approach: display the awp page inside a dynamic page in an iFrame.

Kind regards,
Piet

von Piet van Zanten - am 08.07.2017 18:02
Hi

it is absolutely normal that you WON'T get the context back.

When you are in classic mode, you are running inside a webdev session on the server (like a windev application would), which is webdev specific mode.
As soon as you switch to AWP, you are outside context (each awp page is an independent program, if you would).

Now, there is NO WAY to come back to the original session, as you cannot get the session ID and pass it to webdev to, in some way, reconnect.

It would be like being in a windev program (the original webdev session), running an external program with exerun (the awp page) and from that program, expecting to be able to run the original program again and somehow be back where you were at the beginning... it's just not happening...

However, you can SIMULATE that behavior. The way I do it (and everybody else), is that I pass a parameter from the awp page to a page of the original site. This parameter is something that allows me to reload everything I need to restart a new session that looks like the old one.

My website is a bad example as it is full awp, but the same principal applies: when you buy with paypal, I sent back the invoice number. The original site page then load the context (user login, cart content, and whatever else I need, from the DB where I stored everything before calling paypal). This can be done the same way from a webdev classic site.

Best regards

von Fabrice Harari - am 08.07.2017 19:56
Piet and Fabrice

There are two issues here.

1. Context - that I understand and can deal with.

2. Getting back to the calling page without opening a new browse.

I am trying to do the second. How do I do that? What code are you using Fabrice? You say that everyone is doing that. Do you open a new browse?

Cheers
André

von André Labuschagné - am 08.07.2017 20:27
Hi André,

I'm not sure what you are trying to achieve.
If it is about a call to a payment provider, then you return to the awp page you supplied with the call to the payment provider.
This awp page has no gui elements, it's just there to handle the payment.
In the global declarations server code you process the payment in your database, based on what you get returned from the provider.
You also set a global variable to hold the url to return to (your dynamic site) and fill it based on the result.
So if payment successful,
sUrl="www.mydynamicsite?ordernr="+nOrderNr+"&Some more parameters"

In the on load browser process of the awp page you do a FileDisplay(sUrl) to return to the dynamic site.
In the project code or the code of the first page of your dynamic site, based on the supplied parameter(s) you redirect to a page:
If PageParameter("ordernr")0 and "Some more parameters" then Pagedisplay(Page_PaymentOK)

So in this case you do not need DynamicSiteDisplay.
In fact, it's easier to handle the entry to different pages in your dynamic site by using parameters.
For security reasons you may also consider to put all parameters in a string and encrypt it into one parameter.
(it may even include a time stamp for limited validity)

Kind regards,
Piet

von Piet van Zanten - am 10.07.2017 11:12
Hi André,

The context of Classic Dynamic WebDev server is stored on the server and the session is recognized from the browser. When you navigate to a dynamic site, you have a lot of garbage in the URL. This is the way to identify the unique session. Save this URL before going to your AWP page and then go back to your current session with the same URL. This should work just fine if you are in the same browser window.

You can test it in opening a new tab and copy-past the URL of an active session. This will work. But if you change the device (IP address is different) this will not work. This is a mechanism to avoid someone else using your session. I’m not sure if it works on the same machine but with a different browser. I know there are some security mechanism to avoid session copying (voluntarily or involuntarily).

Take a look at PageAddress(). I think (I’m not sure) that in Classic mode it will return the full URL with the session identifier. So if your AWP page needs to go back to a page depending on the result, you can compute the URL of all required pages with PageAddress() and send them to your AWP page and then call the good one from the AWP page.

I remember couple years ago, PCSoft released a component to make payments to a bank system account (PayPal and others). This component was swiftly going and coming back from AWP and Classic mode. It works in both cases. So you should be able to do it very easily, and if my memory is good, it is only a question of URL having the session ID of your Classic WebDev session.

The only thing that might fail is if the session timeout of your Classic WebDev session is over. Then you need to start a new session.

I hope this will help.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 11.07.2017 13:27
Hi Piet

>I'm not sure what you are trying to achieve.

I am simply trying to get back to the dynamic site after the payment provider has returned to my awp page. I want to place a button the awp page so that it can return to the session of the dynamic [non awp page] that sent the request to the payment provider in the first place.

>If it is about a call to a payment provider, then you return to the awp page you supplied with the call to the payment provider.

I am doing that - and then I want to return to the page that sent the request to the payment provider.

>This awp page has no gui elements, it's just there to handle the payment.

I do not understand what you mean by that - are you referring to the context of the awp page?

>In the global declarations server code you process the payment in your database, based on what you get returned from the provider.

I am doing that - just trying to work out how to process the variables returned from the payment provider.

>You also set a global variable to hold the url to return to (your dynamic site) and fill it based on the result.

That I have tried and it did not work but will try again.

>So if payment successful,
>sUrl="www.mydynamicsite?ordernr="+nOrderNr+"&Some more parameters"
>In the on load browser process of the awp page you do a FileDisplay(sUrl) to return to >the dynamic site.

Will try that.

>In the project code or the code of the first page of your dynamic site, based on the >supplied parameter(s) you redirect to a page:
>If PageParameter("ordernr")0 and "Some more parameters" then Pagedisplay (Page_PaymentOK)

Actually done that in the awp page.

>So in this case you do not need DynamicSiteDisplay.
>In fact, it's easier to handle the entry to different pages in your dynamic site by using >parameters.

Not sure what you mean by that.

>For security reasons you may also consider to put all parameters in a string and encrypt >it into one parameter.
>(it may even include a time stamp for limited validity)

Thanks for the response. Will try what you suggest.

André

von André Labuschagné - am 13.07.2017 10:46
Hi Alexander

Thanks - I am going to try that.

André

von André Labuschagné - am 13.07.2017 10:48
Never did get this to work so I now do this.

1. Call payment gate from dynamic web page where the user selects all their what nots.

2. Payment gate sends notification back to an awp page where I do all the processing.

3. Both complete and cancel is returned to the main dynamic menu page - if they take too long processing in the payment gate and the session of the called page has expired the web app will request a login and password again to commence.

Seems to work well but still doing more testing.

von André Labuschagné - am 18.07.2017 14:48
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.