Alpha DevCon 2018
Results 1 to 10 of 10

Thread: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

  1. #1
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    365

    Default Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    I am using the builder "Open an .a5w page, static HTML page, URL, or .pdf document...." to open a .pdf file stored in a folder, in a pop-up window.

    The file is c:\Alpha5\FreightZone\Documents\test.pdf

    In the builder the PDF filname is \Documents\test.pdf.

    It gives an error "404 Not Found. The requested URL /Documents/test.pdf was not found on this server."

    Even if I hard code the path and file name, I still get he error.

    I can download the same file with no problem, I just can't open it in a pop-up window with the builder.

    I get the same result on a development machine and on a Local Lan machine.

    I recently set up both machines from scratch. On the previous machines this was working. All machines running Win 7.

    Is there a security setting that needs to be set up somewhere? Any ideas are welcome.

  2. #2
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    365

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    Apparently the builder "Open an .a5w page, static HTML page, URL, or .pdf document...." is only looking at files or folders within the Webroot folder.

    I am not sure if this is a result of my publishing settings, or if it is a built in feature of AA.

    a5.get_path() is returning c:\Alpha5\FreightZone

    But the builder is looking in c:\Webroot\FreightZone + \Documents\test.pdf where "\Documents\test.pdf" is the only entry in PDF filename section of the builder.

  3. #3
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,671

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    Yes... it's all relative to the published target folder. It's a web thing. As far as I know you're not allowed to load a local resource... which would be your c:\Alpha5\etc. a5.get_path() is more of a desktop process which returns the path of the currently opened database. It's handy, but not really applicable here.

    Depending on your security settings you may also run into security issues. I don't know how your development environment is set up. My development files, for example, are in the Default.WebProject folder. Create a folder under this named FreightZone\Documents and put your test.pdf in there. If you have security running then, within Alpha, set security for the FreightZone folder and publish. Drill into FreightZone and set security for Documents and publish.

    You could also use S3 to store your PDFs and load them from there.

  4. #4
    "Certified" Alphaholic kkfin's Avatar
    Real Name
    Kenneth
    Join Date
    Dec 2006
    Posts
    1,352

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    It is easy to serve files outside root folder in Alpha Anywhere using Node. You just need require 'http' and 'fs' and then you create a Node server serving 'Content-Type': 'application/pdf'.
    (You need to write the node_service file self there is no builder available.)

  5. #5
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    365

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    If a5.get_path() is not applicable, why are the aliases in Web Project Profile for both the Local Webroot and the Local Lan set to [PathAlias.ADB_Path] = =a5.get_path()?


    In the "File Upload to the Server" builder, in the "Upload Folder" section, the help notes say "If you enter a folder without a drive letter, the folder is assumed to be in the webroot."

    I have entered: \Documents

    In the Web Project Profile for Local Lan, I have this path: \\Ws1\c\A5Webroot

    So when I execute an upload, I expect the file to upload to c:\Webroot\Documents on the Local Lan machine.

    But when I upload a file to the Local Lan, it ends up in c:\Alpha5\FreightZone\Documents, which is not in the webroot.



    The builder "Open an .a5w page, static HTML page, URL, or .pdf document...." will only look in \\Ws1\c\A5Webroot.



    Obviously, I do not understand how this works.

  6. #6
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    365

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    After watching some videos and spending a lot of time on this, I have made some progress.

    I made sure that I am publishing to identical paths on both the Local Webroot and Local Lan.

    I moved my Documents folder where I am uploading and downloading to a folder within the webroot.

    Also it is important to understand the File Download builder - Folder Name - is "relative to the Application Root" so it always starts with the root that is specified in Web Project Profile.

    The Open an .a5w page builder asks for a File Name. It also starts in the webroot.

    So the syntax to find the correct file in the two builders may differ, depending on how you specified the webroot path in Project Profiles.

    Now I can open a file in a pop-up window, or download the file.


    The only problem I still have is specifying the Allowed Download folders in Project Properties.

    The help for Allowed Folders say I can use <ApplicationRoot> as a placeholder. My ApplicationRoot is C:\A5Webroot\FreightZone\

    So I should be able to use C:\A5Webroot\FreightZone\Documents or <ApplicationRoot>Documents

    In both cases it throws a message that I am trying to download from a folder that is not allowed.

    If I leave Allowed Folders blank, it works, but that is not acceptable.

    Any ideas?

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,671

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    In Web Project Settings my Target Folder for publishing is AlphaTest which means I'm publishing to e:\A5Webroot\AlphaTest

    In Project Properties my File Download, Allowed Folders is set to <ApplicationRoot>\Documents

    In my UX, I'm using the File Download action and I specify an Absolute Filename (for my tests). The filename is Documents\test.pdf

    This works since I have a folder on my server... e:\A5Webroot\AlphaTest\Documents... which contains the test.pdf file.

  8. #8
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    365

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    David, I set up a test identical to yours, and it works just fine.

    I failed to mention earlier that the file download type I am using is the ReferencedFilename, rather than the absolute file name.

    So I put a text control on the UX called testDownload.

    In the download builder > Fieldname (referenced file) I put testDownload

    In Folder name I put \Documents

    In Project Properties my File Download, Allowed Folders is set to <ApplicationRoot>\Documents

    The referenced file name action returns "File was not in a folder from which downloads are allowed"

    If I remove <ApplicationRoot>\Documents, it works flawlessly. It will open any file name I put in the testDownload control.

    And the absolute action works in either scenario, as it should.

    Perhaps you can reproduce this?

    Thanks for your help!

  9. #9
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    6,671

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    You're very close. Your ReferencedFilename setting is ok, but your Folder name of \Documents is off a bit. This does not point to a relative folder. You need just Documents here... no backslash.

    And with Project Properties set to <ApplicationRoot>\Documents it all works.

  10. #10
    Member
    Real Name
    Joe Lavely
    Join Date
    Jun 2013
    Posts
    365

    Default Re: Open an .a5w page, static HTML page ... or pdf file returns 404 Not Found error

    I believe I have my issues straightened out. I had some permission problems on the Local Lan machine I was publishing to. I had previously tried the Referenced file name/folder with and without the backslash, and it didn't work. It works now with no backslash.

    Once again, David, thanks for your help.

Similar Threads

  1. Web Page not Found (http 404) error
    By citigirl in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 04-14-2015, 01:23 PM
  2. Open PDF when A5W page is entered
    By parkjammer in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 03-07-2014, 04:39 AM
  3. A5w page code not producing pdf file
    By Steve Bovino in forum Mobile & Browser Applications
    Replies: 4
    Last Post: 11-18-2013, 02:12 PM
  4. Inserting a pdf file into an a5w page
    By webcommerce in forum Application Server Version 11 - Web/Browser Applications
    Replies: 7
    Last Post: 04-12-2013, 01:37 PM
  5. How to solve 404 error when I am calling .ajax.a5w page...!!!!!!!!!!!!!!!!!!!!
    By satyanarayana in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 07-06-2012, 04:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •