title: How to download password protected files from Edge or Chrome
body: <p>How can I download password protected files when downloading the files from Edge or Chrome. Currently, I have code that works for files that are not password protected.</p>
  <p>The following is the code I am using:</p>
  <pre><code>&lt;cfif structKeyExists(URL, 'method') and URL.method eq 'download'&gt;
      &lt;cfset file_name = URL.name /&gt;
      &lt;cfset path = URL.path /&gt;   
      
      &lt;!--- The following if statements determine file type. ---&gt; 
      &lt;cfif findNoCase('.doc', file_name) or findNoCase('.odt', file_name) or findNoCase('.rtf', file_name) &gt;
          &lt;cfset file_type = 'application/msword' &gt;
      &lt;cfelseif findNoCase('.pdf', file_name) &gt;
          &lt;cfset file_type = 'application/pdf' &gt;
      &lt;cfelseif findNoCase('.xls', file_name) or findNoCase('.xlt', file_name) or findNoCase('.csv', file_name)&gt;
          &lt;cfset file_type = 'application/vnd.ms-excel' &gt;
      &lt;cfelseif findNoCase('.tif', file_name) &gt;
          &lt;cfset file_type = 'image' &gt;
      &lt;cfelseif findNoCase('.jpg', file_name) &gt;
          &lt;cfset file_type = 'image/jpeg' &gt;
      &lt;cfelseif findNoCase('.url', file_name) or findNoCase('.lnk', file_name) &gt;
          &lt;cfset file_type = 'text/uri-list' &gt;    
      &lt;/cfif&gt;
  
      &lt;!--- The following if checks which header to use ---&gt;
      &lt;cfif findNoCase('.msg', file_name) or findNoCase('.mdb', file_name) or findNoCase('.wmv', file_name) or findNoCase('.db', file_name)&gt;
          &lt;!--- The following statements creates a downloadable link of the file. This is done by using cfheader and cfcontent ---&gt;   
          &lt;cfheader name=&quot;Content-Disposition&quot; value=&quot;attachment; filename=#file_name#&quot;&gt;
      &lt;cfelse&gt;
          &lt;!--- The following statements creates a downloadable link of the file. This is done by using cfheader and cfcontent ---&gt;   
          &lt;cfheader name=&quot;Content-Disposition&quot; value=&quot;inline; filename=#file_name#&quot;&gt;
      &lt;/cfif&gt;
      
      &lt;!---Check if file type is available. If available, show type. ---&gt;
      &lt;cfif isDefined(&quot;file_type&quot;) &gt;
          &lt;cfcontent type=&quot;#file_type#&quot; file=&quot;#path#\#file_name#&quot;&gt;
      &lt;!--- If file type is not found, display file anyways. ---&gt;
      &lt;cfelse&gt;
          &lt;cfcontent file=&quot;#path#\#file_name#&quot;&gt;
      &lt;/cfif&gt;
      &lt;cfabort&gt;
  &lt;/cfif&gt;
  </code></pre>