MichaSchumann
MichaSchumann

Reputation: 1493

Get complete URL in Delphi TWebmodule

Is it possible to get the complete path like shown in the browsers address entry field within my web application based on TWebModule? What I would like to do is to redirect the user autmatically if he changes the port of the service from within the administration web frontend. Example:

https://someserver:3333/changesettings

is the current url. Request.pathinfo gives me only "changesettings". But I need more to redirect to

https://someserver:1234/changesettings

Any help is very appreciated. Thanks in advance!

Upvotes: 2

Views: 1191

Answers (1)

MichaSchumann
MichaSchumann

Reputation: 1493

Sorry, immediately after asking this question I found the required information right before my very eyes, it's Request.host. I now can easily create the redirection:

 redirecturl:='https://'+request.Host+':'+intToStr(port)+'/settings';

I feed that back into a tag in a pageproducer with the following code

<html>
<head>
<meta http-equiv="Refresh" content="0; url=<#redirecturl>" />
</head>
<body>

Works!

Upvotes: 4

Related Questions