Developer forum

Forum » Development » Adding MIME types

Adding MIME types

Bo Møller
Reply
Is it possible to add a new MIME type for a Dynamicweb solution?
If so - how?

I need to add the following:
mime-type:
extension: .unity3d
MIME type: application/vnd.unity

Replies

 
Morten Bengtson
Reply
Hi Bo!

To serve files with that extension, you need to register the mime-type in IIS on the server.
For sites running on IIS7 you might be able to specify the extension and mime-type in web.config - http://www.iis.net/ConfigReference/system.webServer/staticContent/mimeMap

Do you need to be able to upload those files in front-end of Dynamicweb? In that case, i think a change is required in the core of Dynamicweb, because allowed file extensions is not configurable... I'm not sure if there is a workaround.
 
Nuno Aguiar
Reply
Hi,

A client of ours is longing for such a functionallity. They have a custom solution and want to be able to upload .aspx files to file manager. Would the same solution work?

Nuno

 
Morten Bengtson
Reply
Allowing upload of aspx files is a bit risky (but actually possible in Dynamicweb).

Is your client fully aware of what each line of code in the aspx files does and sure that the files are not making the site vulnerable to malicious attacks?

You can just zip the .aspx files, and choose "Extract archives" in the filemanager on upload. However, the folder probably needs to be configured in IIS to make the aspx work.

If the client needs to be in full control of everything on the site, RDP or FTP access to the site would be a better approach.
 
Nuno Aguiar
Reply
Hi Morten,

That's a great trick. The client is very happy, and yes, both him and I understand the risk.

Thanks a lot.
Nuno

 
Bo Møller
Reply
 Hi again.

Thanks for the answer Morten!
The client will not need to upload the file manually, we will do it by FTP.

Should we just add some extra XML to web.config, and then it should work? It looks like I will need to make changes to IIS in that link you have provided. I don't think this will be possible, since the solution is not running on its own server.

Let me hear your thoughts Morten :-)
 
Morten Bengtson
Reply
You could try adding it to web.config and see if it works? ;-) 
<configuration>
    <system.webServer>

      <staticContent>
         <mimeMap fileExtension=".unity3d" mimeType="application/vnd.unity" />
      </staticContent>

   </system.webServer>
</configuration>




 
Bo Møller
Reply
 Hey again.

Thanks for the answer Morten! :-)
I wanted to try it out, but I don't have access to web.config since it's not a custom solution.

Would it be possible to add a MIME Type when it's not a custom solution?
 
Jais Edelmann
Reply
You would have to add the mime-type to the IIS or as Morten points out you can add it to the configuration of the web.config in order for the application to setup the IIS, no other solution is possible

 

You must be logged in to post in the forum