File Not Found Error (http 404) When Downloading a File from XMPro Mobile App or Website

How Can We Help?

< Back

Issue

This error is commonly caused by a configuration error which is – in most cases – quite easy to resolve.

In an XMPro activity, when you configure a hyperlink object that refers to a report or previously uploaded file, the standard system behavior is to create a relative url. This means the NavigateUrl attribute pointing to the target file will be configured relative to the page the user is currently on when they click on it at runtime.

Consider the following example:

  • Your XMPro website contains a subdirectory named “custom_reports”, which contains a file named “results.pdf”.
  • In an XMPro activity you are configuring, you wish to give your users the ability to download this pdf file by creating a hyperlink object pointing to it.
  • Your XMWorkspace url is configured, in this example, as http://xmpro.example.com:81
  • You also have an XMPro mobile website configured at http://mobile.example.com

By default, the NavigateUrl attribute of your Hyperlink object will look as follows: “custom_reports/results.pdf”.

When a user opens the activity page you created and clicks on the Hyperlink you configured, their Internet browser will automatically derive the correct address as being a combination of the XMWorkspace url combined with “custom_reports/results.pdf”. The resulting request will then allow them to download and view the file successfully.

If, however, a user connects from a mobile device and clicks on the link, their browser will create an address combining the mobile website address above and “custom_reports/results.pdf”. This will result in a “Not found” error, since the pdf file only exists in the XMWorkspace website.

Resolution

The easiest way to resolve this issue is to always configure your Hyperlink objects with the absolute (or full) NavigateUrl attribute.

In the example above, this would mean changing the NavigateUrl attribute of your Hyperlink object to read http://xmpro.example.com:81/custom_reports/results.pdf. You should also consider reading the base address from a configuration setting value, to ensure it is appropriately set when moving between development, test, and production environments.

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X