Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...download hyperlink for .sql filedownload hyperlink for .sql file
Previous
 
Next
New Post
1/21/2014 11:51 AM
 

Hi,

I am trying to create a download hyperlink for a file with .sql file extension.

For example:

<a href="http://leansoftware.net/software/sql/sp_Lean_EDT_GenerateSPforInsertUpdateDelete.sql">Download SQL Source</a>

for some reason the link generates a 404 error.

Any ideas? (I assure you file exists in the specified path!)

 
New Post
1/21/2014 11:57 AM
Accepted Answer 
sounds like an unmapped extension issue - http://stackoverflow.com/questions/10... . If you can't add it as an extension, then you'll need to add some code to stream the file as a download (there are plenty of examples out there,including multiple ones in core code)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
1/21/2014 12:43 PM
 

Brilliant thanks,

that got in the right direction for sure.

I added mine type of .sql with mime type of application/octet-stream

That's fixed the 404 error, but now the file opens in the browser window.

Any idea how to get it to  'download' rather than open the file in the browser ..?

Cheers for your help ..

 
New Post
1/21/2014 1:07 PM
 

I have it now:

In my case I created a Web.Config file in the downloads folder : so it does not apply to the whole site.

This is as well as creating the Mine type as described above.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.webServer>
<rewrite>
  <outboundRules>
    <rule name="Forcing Download for SQLs" preCondition="IsSQL">
      <match serverVariable="RESPONSE_Content-Disposition" pattern=".*" />
      <conditions>
        <add input="{REQUEST_FILENAME}" pattern="(.*)\\([^/]+)\.sql$" />
      </conditions>
      <action type="Rewrite" value="attachment; filename={C:2}.sql" />
    </rule>
    <preConditions>
      <preCondition name="IsSQL">
        <add input="{REQUEST_FILENAME}" pattern="\.sql$" />
      </preCondition>
    </preConditions>
  </outboundRules>
</rewrite>
  </system.webServer>
</configuration>

 

It works - so as a thankyou I give you a useful SQL script to convert an SQL table to Stored Procedure!

(SQL download link at top of article if you would like to try it)

Generate a  stored procedure to Update / Insert or Delete, based on existing Table 

Richard

 
New Post
1/21/2014 1:54 PM
 

I can't edit the above link, the correct link to the mentioned SQL script is :

http://leansoftware.net/forum/en-us/h...

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...download hyperlink for .sql filedownload hyperlink for .sql file


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out