Jump to content

Handle Stateless Requests


wkotze

Recommended Posts

Hi Guys. I am new to Unigui. love it.!! great work Farshad!

I've create a normal Unigui app with login, forms and all that goes with it...
The app will sent emails to users containing  <a href links to action tasks (eg. activation, password reset, etc)

My first thinking was to handle this requests with separate  PHP page requests, but I  would prefer a "Delphi" way

Will using ServerModule.HTTPCommand be the best way to do this ?

If i should go this route, I am unsure on how best to connect to database (i use mssql with ado)
regarding connection pooling and tread issues on sessions

Should I create an ad-hoc Tadoconnection and action the request,
OR
or can I still  try to access it via my  mainmodule  adoconnection,

Thank you guys

Wihan

 

 

Link to comment
Share on other sites

You want to respond to http requests for doing simple tasks, and you can use Unigui for this.

The benefit is to have all the code in one place.

The best way to do this is to use URL parameters for those tasks, with an ID for identifying the user,
and picking this up in the MainForm, and there choosing which subform to display.

Normally a user would have to log in to your app, but in the MainModule you also check for
the presence of a URL parameter and do an automatic login based on the URL ID, which
you check against a table with an expiry date.

So for the task you direct the user to your special form and let him do whatever it is,
and then afterwards either log him out or direct him to his account page, e.g.

The HTTPCommand function is presently not working in ISAPI mode, so I would not
go that way. Besides, it is not necessary at all when you can use URL parameters as explained above.

The only reason you would actually use HTTPCommand would be if you did not want to engage
any forms but just do some simple HTTP response - but for that kind of job I would rather
create a VCL service app using the Indy HTTP Server. It would give me much more freedom
to configure the server, as it would not be running under Apache or IIS and restricted to their port.

Link to comment
Share on other sites

I like your suggestion, thank you Ron

not using iis/apache, My thinking with HTTPCommand  was that it would be "less expensive" resouse wise as no session is created,
I would just be hit-do-whatever-and-get-out ?

 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...