WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed (/thread-1962.html) Pages:
1
2
|
WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - jeroen.rottink - 09-11-2020 Hi, WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) in IW15.1.22 works different from IW15.2.17 In the old version the current session would be terminated and a new one would be started. In the new version the current session is terminated and a 303 status is send to the browser. Code: procedure TIWForm1.IWButton1Click(Sender: TObject); I used it to logout a user and present the logon screen again. WebApplication.TerminateAndRedirect('logoff.html') still works as expected. RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Alexandre Machado - 09-15-2020 Hi, Redirections indeed changed. I'll have a look why this case of yours is not working. I'll keep you posted. RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Alexandre Machado - 09-15-2020 I've just tested it and it works as expected in all scenarios (both Sync and async requests, via content handlers, when creating a new form, etc). Indeed we use 303 status when possible to do some redirections but it shouldn't change any visible behavior. Isn't it redirecting for you? RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - jeroen.rottink - 09-15-2020 Hi Alexandre, No, it isn't redirecting. I tested using Chrome and Edge. IE is working but not used by my customers What can be the difference? I can send you an example but it's just generated from the wizard with a button and attached OnClick... Request URL: http://127.0.0.1:8888/ Request Method: POST Status Code: 303 See Other Remote Address: 127.0.0.1:8888 Referrer Policy: no-referrer-when-downgrade Cache-Control: no-cache, must-revalidate Connection: close Content-Length: 0 Content-Type: text/html; charset=UTF-8 Date: Tue, 15 Sep 2020 10:45:07 GMT location P3P: CP="NO P3P" Pragma: no-cache Set-Cookie: IW_MyApp=; Path=/; Expires=Fri, 29-Dec-1899 02:00:00 GMT Set-Cookie: IW_MyApp=; Path=/; Expires=Fri, 29-Dec-1899 02:00:00 GMT Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate, br Accept-Language: nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7 Cache-Control: max-age=0 Connection: keep-alive Content-Length: 217 Content-Type: application/x-www-form-urlencoded Cookie: IW_MyApp=8erMoVS6RncDEXbhRTv~SdUdFPe_1 Host: 127.0.0.1:8888 Origin: http://127.0.0.1:8888 Referer: http://127.0.0.1:8888/ Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: same-origin Sec-Fetch-User: ?1 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36 IWBUTTON1: IWBUTTON2: IW_FormName: IWForm1 IW_FormClass: TIWForm1 IW_width: 1196 IW_height: 310 IW_Action: IWBUTTON1 IW_ActionParam: IW_Offset: 0,160 IW_SessionID_: 8erMoVS6RncDEXbhRTv~SdUdFPe IW_TrackID_: 1 IW_WindowID_: RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Alexandre Machado - 09-15-2020 Hum... Let me do some other tests. I'll get back to you RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Alexandre Machado - 09-15-2020 Here is the thing. Instead of doing this: Code: procedure TIWForm1.IWButton1Click(Sender: TObject); try this: Code: procedure TIWForm1.IWButton1Click(Sender: TObject); It will work as expected. IntraWeb removes the host part of the URL when redirecting, in case the URL points to the same application. This is done to make it easier to work with reverse proxy servers. When you use ApplicationURL, the resulting location URL is empty and Chrome (webkit browsers) don't like it. The recommended way of redirecting to the same application is indeed AppUrlBase (instead of ApplicationURL). We will change the code to prevent an empty URL used in redirection so ApplicationURL will also work as AppUrlBase. RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Joao Lira - 12-30-2020 (09-15-2020, 11:50 AM)Alexandre Machado Wrote: IntraWeb removes the host part of the URL when redirecting, in case the URL points to the same application. This is done to make it easier to work with reverse proxy servers. Is there a way to make this functionality optional? Let's suppose that you have a webpage like this: 'https://www.myweb.com' for English speakers and 'https://www.myweb.com/spa/index.html' for Spanish speakers. Your application is hosted in a URLBase like 'https://www.myweb.com/myapp/'. If you want to use 'TerminateAndRedirect' to the main web page (English), it is ok, but if you want to redirect to the Spanish webpage, and due to the fact of IntraWeb removes the host part of the URL, the redirect will be done to 'https://spa/index.html' and it won't work, of course. Is it possible to include a parameter (true, false) to avoid the 'host part' removal? RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Alexandre Machado - 01-06-2021 (12-30-2020, 11:34 PM)Joao Lira Wrote:(09-15-2020, 11:50 AM)Alexandre Machado Wrote: IntraWeb removes the host part of the URL when redirecting, in case the URL points to the same application. This is done to make it easier to work with reverse proxy servers. Your spanish version should run under 'https://www.myweb.com/myapp/spa/index.html no?? Is this the same application or a different one? RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Joao Lira - 01-06-2021 (01-06-2021, 09:29 AM)Alexandre Machado Wrote: Your spanish version should run under The application is a "link" of a website in plain HTML, CSS. So the website is at 'https://www.myweb.com', and the app (for ALL languages) is at 'http://www.myweb.com/myapp/' as (for the app) the language is changed dynamically in the app itself, and when this happens the return to the 'main page' should be done to the right one HTML webpage - English, Spanish - not the app - using 'WebApplication.TerminateAndRedirect', but currently, because of Intraweb removes the host part of the URL, it is not working for any webpage other than the main webpage. So, currently, all redirecting has to be done to 'https://www.myweb.com', as if 'https://www.myweb.com/anyotherurl/' is used it redirects to 'https://anyotherurl/'. The overloaded version of 'TerminateAndRedirect' with the 'aPrependBaseURL' parameter also gives the same result, no matter the parameter is set to true or false. RE: WebApplication.TerminateAndRedirect(WebApplication.ApplicationURL) changed - Alexandre Machado - 01-12-2021 I see. Is this website being hosted on IIS? I'll do some testing and let you know the progress... Cheers |