Subject Re: Open Connections
From Stephan Koenig <S.Koenig@LaserPlus.de>
Date Wed, 12 Jan 2005 12:00:57 -0500
Newsgroups xb2net

Anything wrong with this code ? Do I need a StatusCode saying that the page
is okay ("error.html" is not really an error page)

procedure FileNotFound( oClient )

local oReq     := oClient:HTTPRequest
local oResp    := oClient:HTTPResponse
local cmessage
local I

local cPath        := oClient:HTTPRequest:Path()
local cWebFunction
local cAction      := cPath
local cHost        := oClient:HTTPRequest:Host()
if empty( cHost )
   cHost := ""
else
   cHost := lower( cHost )
endif

// strip out port numbers
if ( i := at( ':', cHost ) ) > 0
   cHost := left( cHost, i - 1 )
endif

// modify requested path
if upper( substr( chost, 1, 4 ) ) = "WWW."
   chost := substr( chost, 5 )
endif

if !file( "c:\web\" + chost, "D" )

   cmessage      := memoread( "error.html" )
   oResp:Content := cmessage

else

   oResp:StatusCode  := 404
   oResp:ContentType := "text/plain"

   oResp:Content := "Page not found / Seite nicht gefunden"

endif

return



Recent messages in this thread
 
-# Re: Open Connections Boris Borzic <ng-... 12-Jan-2005 11:22 am
.\# Re: Open Connections (Current message) Stephan Koenig 12-Jan-2005 12:00 pm