06-19-2014 07:22 AM
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!
Solved! Go to Solution.
06-20-2014 03:36 PM
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?
06-21-2014 08:18 AM
Shane,
I would rather display them a custom 404 page, although the other option would work as well.
thx!
06-23-2014 02:51 PM
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.
06-23-2014 03:35 PM
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.
06-24-2014 02:13 PM
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.
06-25-2014 06:28 AM
06-25-2014 07:00 AM
@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?
06-25-2014 08:29 AM
06-25-2014 08:50 AM
@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. 😉