Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CustomContentHandler for ReEntry
#10
(04-17-2019, 04:12 PM)pete@pdmagic.com Wrote: Urgent: Demo this afternoon.  I'm using a TContentForm handler and it is working as desired.
HOWEVER: After executing such a call, the URL changes to the name of the content handler. All subsequent navigation in my app are now at that URL.  It keeps working, but it now has a new URL base and any files referenced relative to the real base URL are not found.

Normal URL when navigating the app:
http://myserver/cm/cmo.dll/  
ContentForm example call:
http://myserver/cm/cmo.dll/MyContentHandler?this=that&a=b
After ContentForm call, further navigation looks like this:
http://myserver/cm/cmo.dll/MyContentHandler/

As a result, a file that should be able to referenced as
http://myserver/cm/cmo.dll/files/test.html
when referenced relatively looks like this:
http://myserver/cm/cmo.dll/MyContentHandler/files/test.html
and is therefore not found.

Any ideas how to get rid of the content handler suffix?

Thanks,
Pete

Hi Pete,

When you call the content handler your application url becomes the url of the content form. In your case:

http://myserver/cm/cmo.dll/MyContentHandler

Not sure how you close this form...

However seems that the address of the file is document-relative so it is appended to your current path.

If you reference your file starting with a slash, it will become root-relative, which is the correct file address.

So, the relative url of that file should be 

'/files/test.html'

This will fix the file issue, but not exactly sure about the form address though. You can release the form and navigate to the root of your
application using WebApplication.GotoURL('/'). Probably you can try this:

(example where a Button1 on your content form will close the form and go back to the root)

procedure TForm1.Button1Click(Sender: TObject);
begin
  Release;
  WebApplication.GoToUrl(WebApplication.SessionUrlBase);
end;



ContentForms have a nice feature which allows navigation through the application using URL addresses (just like shown in ContentHandlersDemo, mentioned below by Erwin), but this feature might not be desired in all scenarios.
Reply


Messages In This Thread
RE: CustomContentHandler for ReEntry - by kudzu - 04-04-2019, 12:10 AM
RE: CustomContentHandler for ReEntry - by Alexandre Machado - 05-22-2019, 10:55 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)