HandleSpecialURL alternative for app level data in Web2.0

Hi team,
I’m busily porting my 1.0 web app across to 2.0 and am having trouble getting my head around HandleURL as opposed to HandleSpecialURL.

In the past, I’ve used another helper app to send data to my web server using a loadURL call to“mydatahere”
I had an event handler at the app level that read this string and then saved it for use in realtime in my website.

I don’t want this data to be session specific, I just want to fire the event when data is received and save it somewhere much like the old SpecialURL did. Any suggestions on how I should be doing this?

You can use HandleURL with something like

Function HandleURL(Request As WebRequest, Response As WebResponse) Handles HandleURL as Boolean
  If Request.Path = "" Then
    Return False
  End If
  If Request.Path.BeginsWith("special") Then
    Var Folder As String = Request.Path.NthField("/", 2)
    Var File As String = Request.Path.NthField("/", 3)
    Var Data As String = Request.QueryString
    // Do something with the variables
    Response.Status = 200
    Return True
  End If
  Return False ' Generate a 404 error
End Function

Untested, but you get the idea.

Thanks Wayne,

Worked a treat, for some reason I thought I’d tried this bt it works with this code!


Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.