|
<< Click to Display Table of Contents >> Navigation: Telegram > 2018 > 05 > 18 > Telegram_2018-05-18T06 |
2018-05-18T06:12:54
What is the best way to redirect to a web URL and quit an IW application when a user clicks a Logout button?
2018-05-18T06:21:56
procedure TIWForm1.IWButton_LogoutClick(Sender: TObject);
begin
Release;
WebApplication.TerminateAndRedirect( ' type: link https://jnp.com.br ' );
end;
2018-05-18T06:23:45
OK, I'll try that. Thanks.
2018-05-18T06:27:22
Yes, That worked perfect! Thanks!
2018-05-18T06:28:38
About your question:
\Also, is there a way to eliminate the /$ type: bot_command /start at the end of the URL to get the initial web page to appear.\
2018-05-18T06:28:53
Yes, there are.
2018-05-18T06:29:12
You have a type: bold Login page?
2018-05-18T06:41:06
Yes I do
2018-05-18T06:43:17
at the end of this form you set ?;
type: bold initialization
TIWForm_Login.SetAsMainForm;
2018-05-18T06:44:33
It already there. It looks like this:
2018-05-18T06:44:35
initialization
TfrmMain.SetAsMainForm;
2018-05-18T06:44:41
great
2018-05-18T06:45:05
So if I call the URL without /$ it will already work?
2018-05-18T06:45:13
Now, in servercontroller:
2018-05-18T06:45:22
type: bold initialization
TIWServerController.SetServerControllerClass;
with THandlers.Add('', 'login.html', TContentForm.Create( TfrmMain )) do begin
CanStartSession := True;
RequiresSessionStart := False;
end;
2018-05-18T06:45:49
add type: bold with tHandlers at the end
2018-05-18T06:46:23
after that you can type: bot_command /login type: bold .html to start a session
2018-05-18T06:50:12
So what you are saying is on the IWserverController OnCreate event. add the code above.
2018-05-18T06:50:17
procedure TIWServerController.IWServerControllerBaseCreate(Sender: TObject);
begin
with THandlers.Add('', 'login.html', TContentForm.Create( TfrmMain )) do begin
CanStartSession := True;
RequiresSessionStart := False;
end;
end;
2018-05-18T06:50:26
Like that?
2018-05-18T06:51:32
No, put at the end of servercontroller, like frmmain
2018-05-18T06:52:14
after type: bold initialization
2018-05-18T06:52:17
OK, this was already in there
2018-05-18T06:52:18
initialization
TIWServerController.SetServerControllerClass;
2018-05-18T06:52:44
ok, now ADD after that;
with THandlers.Add('', 'login.html', TContentForm.Create( TfrmMain )) do begin
CanStartSession := True;
RequiresSessionStart := False;
end;
2018-05-18T06:53:28
OK, so now I have this:
2018-05-18T06:53:29
initialization
TIWServerController.SetServerControllerClass;
with THandlers.Add('', 'login.html', TContentForm.Create( TfrmMain )) do begin
CanStartSession := True;
RequiresSessionStart := False;
end;
2018-05-18T06:53:32
Yes
2018-05-18T06:54:25
So I have an undeclared identifier THandlers for my 1st compile error. Do I need some more in the Uses section?
2018-05-18T06:54:55
miss a uses, 1 min
2018-05-18T06:55:46
USES
IW.Content.Handlers, IW.Content.Form
2018-05-18T06:56:37
OK, so I will have to also add the TfrmMain, correct?
2018-05-18T06:56:51
Yes
2018-05-18T06:58:07
OK, it compiles. You also mentioned \add with tHandlers at the end\