NetTalk Central

Author Topic: Web32 Error Pages  (Read 2170 times)

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Web32 Error Pages
« on: April 15, 2012, 09:57:00 PM »
Hi,

Just testing web32 and found that the page only shows correctly in IE, not Firefox. It seems that Firefox is not rendering the HTML code correctly. Is this a bug in NetTalk or Firefox?

Also is it possible to create a NetWebPage or Form that has the HTML code for the 'ErrorPage' and have the WebHandler open this page? i.e.

if p_ErrorNumber = 404
  ErrorPage()
end

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Web32 Error Pages
« Reply #1 on: April 15, 2012, 10:54:52 PM »
Neither I guess, it's a bug in the example.

In NT4 the code was in the WebServer procedure, and would have been fine, but in NT5 it was moved to the WebHandler (so that it would work when the app is used under the multi-site host.)

The WebHandler though needs a couple more lines, so

    ReturnValue =  '<html><head><title>' & p_ErrorNumber & ' ' & clip(p_ErrorString) & '</title><13,10>' & |

becomes

    self.HeaderDetails.ResponseNumber = '404'   
    self.HeaderDetails.ResponseString = 'Page Not Found'
    ReturnValue = self.CreateHeader(self.HeaderDetails) & '<13,10>'  & |
                 '<html><head><title>' & p_ErrorNumber & ' ' & clip(p_ErrorString) & '</title><13,10>' & |

ie, a couple lines before to set the HeaderDetails, and the Header itself prepended to the text of the error.

I'll update the example for the 6.28 build - thanks for the report.

cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Web32 Error Pages
« Reply #2 on: April 15, 2012, 11:32:06 PM »
Thank you Bruce.

I have updated the code as it is below but now when I test going to a page that doesn't exist I don't get the error message in IE. I just get the standard IE 404 error page.

It works in FF though :)

Regards,
Trent

Update: after some research it could be the "self.HeaderDetails.ResponseNumber = '404'" line that causes IE to shows it's default 404 error page.

Can you pass a static page in the web folder in the 'MakeErrorPage' embed? Or even a NetWebForm or Page so that the page also has a header, footer and menu?
« Last Edit: April 16, 2012, 01:21:40 AM by trent »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Web32 Error Pages
« Reply #3 on: April 16, 2012, 10:49:51 AM »
IE doesn't like "short" error pages. Make your page a bit longer an then IE will show it.

Cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: Web32 Error Pages
« Reply #4 on: April 16, 2012, 02:00:37 PM »
Works perfectly! Thanks Bruce.

Regards,
Trent

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
    • Email
Re: Web32 Error Pages
« Reply #5 on: April 23, 2012, 02:39:16 PM »
Hallo Bruce,

Can you update also the code in NT5? the error page example doesn't work.
*after I replace with your above new code works again!

Thank you,
Robert