LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a 404 page with LabVIEW web services?

Solved!
Go to solution

Hi community,

 

I guess the question says it all... I have my site up and running but I'd like to create a default 404 page just in case the user mistypes something. How can I do that?

 

thank!

0 Kudos
Message 1 of 25
(3,237 Views)

Hello, 


What do you want the behavior of this page to be?  Do you want a page that displays whenever the user enters in a webpage that doesn't exist, or do you want to route them to someplace specific when they enter in incorrect parameters?

 

0 Kudos
Message 2 of 25
(3,184 Views)

Shane,

 

I would rather display them a custom 404 page, although the other option would work as well.

 

thx!

0 Kudos
Message 3 of 25
(3,168 Views)

If you are using LabVIEW 2013, then the example finder contains a pretty good example demonstrating how to re-direct users if an error occurs in their input string.  Open LabVIEW, then go to Help>>Find Examples.  Here search for Web Services.  Web Services - Weather Monitoring.lvproj should come up.  Open that.  There are instructions in the HTML link in the project for how to run the project.

 

Under Server Appliction>>Web Resources>>Get Data.VI you will find an example that demonstrates re-routing a user if they input an incorrect data type.  You could expand this example to cover any type of error you would like.  

0 Kudos
Message 4 of 25
(3,122 Views)

I either completely misunderstand the example, or we are talking about completely different things. 404 is an error for webpage not found, so I can not process it from a VI as thats the bottom of the problem: the user calls something which is non existent.

0 Kudos
Message 5 of 25
(3,112 Views)

Perhaps my reply was a little confusing, but I was answering the question " do you want to route them to someplace specific when they enter in incorrect parameters" from my earlier post.  If you run that example, then enter an incorrect parameter, such as the string "http://127.0.0.1:8002/WeatherMonitor/Get_Data?format=image/pn", you will get routed to an error message page with the text "Invalid Format".  If you look in the code you will see where the Invalid Format error is being handled.  If you enter in an invalid string of text besides that, like "http://127.0.0.1:8002/WeatherMonitor/" for example, you will automatically come up with an Error 404 page.

0 Kudos
Message 6 of 25
(3,079 Views)
Alright... My original question was about how to create a 404 page, then you have asked back and I have assumed your question of "incorrect parameter" is about to answer my original question. Its not though as 404 is not when you call something existing with a bad param but when you call something really non existing. So I assume we both missunderstood each other.

Lets go back to the original question: how can i create and use a custom 404 message.

Thx.
0 Kudos
Message 7 of 25
(3,058 Views)

@1984 wrote:
Alright... My original question was about how to create a 404 page, then you have asked back and I have assumed your question of "incorrect parameter" is about to answer my original question. Its not though as 404 is not when you call something existing with a bad param but when you call something really non existing. So I assume we both missunderstood each other.

Lets go back to the original question: how can i create and use a custom 404 message.

Thx.

What do you mean then?  How to publish a web page?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 25
(3,050 Views)
My question is how can I configure LV to display a custom 404 message instead of just displaying the default?

Thanks for asking if i have problems publishing a page after I wrote in my first comment that I have my site up and running.
0 Kudos
Message 9 of 25
(3,036 Views)

@1984 wrote:
My question is how can I configure LV to display a custom 404 message instead of just displaying the default?

Thanks for asking if i have problems publishing a page after I wrote in my first comment that I have my site up and running.

I believe he's telling you to use the same logic that was used to display the error, but instead of displaying an error, display your custom page.  I asked if you had trouble publishing the page because I thought that Shane's clarification post was pretty self-explanatory and that was the only thing I could think that you would be having issues with.  And I guess your site isn't truly up and running if you wanted to display a custom 404 page and was not able to do so.  I would say it was still under construction.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 25
(3,030 Views)