Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
11
Erster Beitrag:
vor 3 Jahren, 8 Monaten
Letzter Beitrag:
vor 3 Jahren, 8 Monaten
Beteiligte Autoren:
Joel, Piet van Zanten, Alexandre Leclerc, Allard, Fabrice Harari

How to run Browser function in Server Code

Startbeitrag von Joel am 26.08.2014 09:09

Hi everyone -

I need to run a browser function in the server code of a link. I know you can't do that, but there must be a way to work around it. Here's my code:

IF gpoLogin:m_bLogInOK = False THEN
LIBF_LoginError = "Sorry, But the ID and Password entered do not match - please try again"
EDT_Password=""
EDT_ClientID=""
ELSE
//Open new project
LIBF_LoginError="Now we would open the Menu project"
BrowserOpen("http://www.martialartsforamerica.net/WD190AWP/WD190Awp.exe/CONNECT/MAFA_SM_Financial_Module?SID=AMAPD";)

END


Anyone have a "trick" to do this?

Antworten:

Hi Joel
Just answered that same question last week (I think) on the pcsoft US forum (and no, they are NOT copying BACK their native traffic anymore, just taking the traffic generated here)... yep, here it is:

http://forum.pcsoft.fr/en-US/pcsoft.us.webdev/1374-calling-browser-procedures-1377/read.awp?hl=browser,timer,hidden

best regards

von Fabrice Harari - am 26.08.2014 11:06
Hi Joel,

You could do it all in browser code, using AjaxExecute to do the login check.
Take a look at DynamicSitedisplay and its examples in the Help.

Regards,
Piet

von Piet van Zanten - am 26.08.2014 16:37
Hi Joel,

I must add that starting your site from browser code without a login validation on your actual site is a security risk.
The link you use to start your site will be visible and can be used to access your site without login.

Regards,
Piet

von Piet van Zanten - am 26.08.2014 16:51
Hi,
I donnot get what you all are saying. I do this kind of things in servercode ( clik proces of a button ) and activate ajax.

What aar you exacly trying to achief. ? You do a check on a paswword and a client Id

I guess these thing are normaly stored in a db ?

If you discribe a bit more what you want to do what your project is then I can help . With this Hmm not really

regards

Allard

von Allard - am 26.08.2014 20:30
That's it Piet! Thank you!

DynamicSiteDisplay - I knew there had to be a way to do it. Finding it is the hard part! And not to worry - I will have a login check for security but thanks for the reminder!

von Joel - am 27.08.2014 19:17
Hi Allard -

Yes, I do the check in server code and that's easy. If the check is "ok" (they have a right to enter the system) I then need to go to the "Main Menu" project (I am breaking my project down into "sub" projects because altogether it's too big.

There doesn't seem to be a way to open a new site in server code, it has to be done in browser code. But I can't do the check in browser code - or I don't know how.

Does that help?

von Joel - am 27.08.2014 19:40
Well Piet, perhaps I spoke too soon.

I put this in the browser code of a link:
DynamicSiteDisplay("MAFA_SM_Financial_Module","","SID=AMATEST&DS=S1",CurrentBrowser,"")
and tried in on my development machine and nothing happened - except a notice down in the corner of my browser that the server was being accessed.

Then I thought - well, maybe it won't work on the development machine and so I uploaded a test page and got the same result.

I give - what am I missing?

von Joel - am 28.08.2014 01:45
Hi Joel,

I have no experience with this function, just thought it might be useful in this case.
I'll try to test a little this weekend.

Regards,
Piet

von Piet van Zanten - am 28.08.2014 06:01
Hi Joel,

Have you authorized the page MAFA_SM_Financial_Module to be accessed directly (as specified in the help)?

Also for your problem using browser code on server side, you can do the reverse. In the browser code, you could call an AJAX procedure on the server using AJAXExecute() and validate the result. Then if the result is good, proceed with the display of the good page. But make sure you also validate the user once in the WebDev session so that it really is an authenticated user. (So if someone bookmark the page, coming back on it will ask for proper login.)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 28.08.2014 12:13
Hi everyone -

Well, I found a work around. I remembered that a Button or a Link has an "other Actions" setting and in there was a place to put a link to open a new webpage. I dropped in the url of my "Main Menu" project and Viola! It worked. The new project opened up in the current browser - perfect!

The only problem now is that a human must press that button to get it to work. so my solution there was to make the button invisible, do the code to validate the user ini another link and if returns "true" make the button visible for the user to click on. I don't like that as it adds another step to the process for the user, but it works fine for now. I'll keep working on other solutions like "DynamicSiteDisplay", etc.

It's also a good solution for my Menu - just click on the link and the new project opens in the current browser. A little checking to make sure the user is valid and it's set. I also found the ..URL property so I can't set the URL the button goes to dynamically.

As I always have said - I know there's a way, it's just finding the right information to make it happen.

Anyone have a suggestion so the user doesn't have to actually click the button once it's visible? Can't use "trtclick" because the code is not in the "click" code of the button. Somehow, it's in the button itself. But if the button can do it, there should be a way to do it programmably, no?

Thanks for everyone's help -

J

von Joel - am 28.08.2014 15:24
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.