Change the Object Not Found and Protected Object Pages.

Hi All,
I am using Digi Connect ME customisation kit with Net+OS 7.3.
I would like to change the object not found page and protected object page with my own pages.
I checked on the Advanced Web Server Toolkit and couldn’t find any information regarding this.
Has anyone done this? any ideas and suggestions welcome.
Please help me to change these pages to redirect to home page.
Thank you

Look in the API reference guide in the documentation directory. In that directory is a file entitled AprReference.chm. In that file, look for the following:
Web Servers/Advanced Web Server/Functions

In that section look at NAHSStartServer()
Follow the live link for HS_SERVER_PARAMETER. You’ll find what you are looking for.

Hi sparkys_dad

Thanks for the right directions.

Do I have start the AWS manually if I want to set custom pages for Page not found and protected object pages?
I am using the default initAppServices() created by the project wizard and that calls HTTPServer_Init() within that it just calls the RpHSStartServer() function and I don’t see it is setting up the web server with HS_SERVER_PARAMETER. Do you know where they set those parameters ?

Thank you



Hi ,

I found that default settings shoud be defined with in this void naHSDefaultSetting (HS_SERVER_PARAMETER * server_data); function.
But I can’t get to the definition of the function. any idea how to find the function definition ?

Thank you




This is just an educated guess. According to the help file this function is contained in the library code so you will not be able to find the source for it. However if you define the function in your own code then when the application is built the linker should choose the function in your code rather than the one in the library

CLearly the code in a project built by ESP is for users who want to use the defaults. Clearly your usage model is “beyond the Pale”. So if I were doing this, the following is what I would do:

In your project (ESP generated code) in sys\http\httpsvr.c

You'll want to replace the call to RPHSStartServer() with a call to NAHSStartServer().

Now, here is wher it gets technical. The call to RPHSStartServer() takes no arguments. The call to NAHSStartServer() takes a pointer to a structure that holds tons are arguments which give you greater flexibilty on the running of the AWS. You MUST do the following:

call naHSDefaultSetting THEN fill in the structure with the values you want. then call NAHSStartServer(). The structure MUST be zeroed out and then filled in (remember that stack variables are NOT zeroed out as globals are. naHSDefaultSetting will zero the structure out and ensure that all fields in teh structure are filled in with default values.

Also please do two things.

Read the API reference document entries for naHSDefaultSetting () and NAHSStartServer(). Also in the installed tree, in src\examples look at the root.c file for the example nahttp_pd. You will see an example of how to use naHSDefaultSetting () and NAHSStartServer()

WHen you get through this you should be able to override the default error pages with the ones you want to use.

Another option, instead of modifying sys\http\httpsvr.c, is this:
When you create your project don’t select the Web Server service, this will set the HTTP_SERVER_ENABLED label to false in appservices.h file and RpHSStartServer() function will not be called.

Then include something like this in your application code:

/* Get default settings. */
naHSDefaultSetting( &serverData );

Here modify whatever serverData parameters you want.

/* Start the HTTP server. */
NAHSStartServer( serverData );

Hope it helps.

Best regards,