coldfusionluceecommandbox

How is aws console able to provide a way to download an RDP file but I can't on my local intranet?


Intranet website.

I have a web page using Coldfusion/Lucee/CommandBox displaying a list of servers. Next to a server is an icon that is linked to a verified working RDP file.

If I double-click directly from the explorer, they'll open just fine. If I try to download them from the website, I'll get a "Couldn't download - Network issue". That made me think it was a GPO issue as it was happening in Chrome and Edge. However, in AWS, I CAN download an RDP profile. I inspected the AWS source code but it's very difficult to make sense of it. I also reviewed the downloaded RDP file using Notepad++. I also took this AWS downloaded file and placed it on my web page and hardcoded the link. The same AWS rdp file will not download.

Does anyone know what AWS is doing to make this work?

And

Does anyone know how I can link to my RDP file and have it download like most any other file?

SRVNM001 <a href="/?action=serverList"><i class="fa fa-wrench"></i></a><a href="/docs/RDP/SRVNM001.rdp" download>RDP</a>

Solution

  • I was missing a cfheader refernce. cfheader(name="Content-Disposition",value="attachment;filename=#local.fileName#.rdp" );

    <cfscript>
    local.fileName = url.serverName;
    
    local.fileContents = "auto connect:i:1
    full address:s:#url.serverName#";
    local.filePath = "/downloads/RDP/#local.fileName#.rdp";
    
    try{
        FileWrite(local.filePath, local.fileContents);
    
        cfheader(name="Content-Disposition",value="attachment;filename=#local.fileName#.rdp" );
        cfcontent(file=local.filePath, type="text/plain" );
    
    } catch (any e) {
        writeOutput("An error occurred creating the RDP file. Error: " & e.message);
        abort;
    }
    </cfscript>