[SOLVED] Help for the start of HTTPServer lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- egsuh · 2020-09-16 11:05 Hi, I can write CGI or FCGI web server, but not the simple(?) HTTPServer.  I cannot make it start. Please see my following example. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program HTTPServer; {$mode objfpc}{$H+} uses  Sysutils, fpwebfile,  fphttpapp; begin  RegisterFileLocation('Demos','C:\inetpub\wwwroot\Demos');  Application.Title:='httpproject1';  Application.Port:=8040;  Application.Initialize;  Application.Run;end. No other units. I run this, open a browser, and type "http://localhost:8040/demos/abc.html". What I get is an error message (attached file). This is my first time to try HTTPServer. Please advise me what I'm doing wrong. Windows 10, and IIS is running. So, localhost/demos/abc.html works fine. ---------------------------------------------------------------------- PascalDragon · 2020-09-16 11:32 You're probably falling victim to this problem which results in the simple RegisterFileLocation not working Windows. It should be possible to use the following “hack” instead (requires 3.2.0): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  TSimpleFileModule.BaseDir := 'C:\inetpub\wwwroot\Demos';  HTTPRouter.RegisterRoute('/Demos/*', TSimpleFileModule.HandleSimpleFileRequest);  // ...end. Or if your program is started from C:\ as well you can try this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i RegisterFileLocation('/Demos/*','/inetpub\wwwroot\Demos'); This is a so called drive absolute path and uses the drive of the current working directory as root (this is done by Windows). The ‘/’ instead of ‘\’ is necessary because of the code in RegisterFileLocation, otherwise ‘\’ would be okay. ---------------------------------------------------------------------- egsuh · 2020-09-16 12:21 Quotesimple RegisterFileLocation not working Windows. Ah... problem with Windows file definition.  My current FPC version is 3.0.8. I'll upgrade it and try your first hack. Thank you very much. ---------------------------------------------------------------------- PascalDragon · 2020-09-17 07:28 Quote from: egsuh on September 16, 2020, 02:21:14 pmAh... problem with Windows file definition.  My current FPC version is 3.0.8. I'll upgrade it and try your first hack. Thank you very much. I take it you either mean FPC 3.0.4 or Lazarus 2.0.8? ---------------------------------------------------------------------- egsuh · 2020-09-17 09:59 QuoteI take it you either mean FPC 3.0.4 or Lazarus 2.0.8? You are right. Sorry for the confusion.