Downloading ISO file - asp.net-mvc-3

When i try to download iso file, it results in 404 page not found. The link in this instance is like:
http://www.domain.com/virtualDir/filename.iso
virtualDir points to a location on our file servers.
I don't want to read the binary array and then push it out as download since it is almost 600mb. I want the browser to handle this just like exes and zips.
What is the best way to handle this?

I would imagine it is because IIS doesn't serve unknown file extensions. You need to add the MIME type to the overall IIS settings, or the web.config. As you asked for in the comment, I'd probably recommend placing it in the web.config since it doesn't require additional configuration from a sysadmin and everything is in one place.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".iso" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>

Related

enabling caching of js/css files with nodejs/iis7 reverse proxy

I have a nodejs backend, site served through iis7 via reverse proxy as per this website: https://alex.domenici.net/archive/deploying-a-node-js-application-on-windows-iis-using-a-reverse-proxy. In the node app i have a middleware layer to all get requests to cache content, like so
res.set('Cache-control', public, max-age=${period})
When running on my local machine i'm checking the headers via google developer tools and it does look like caching is working properly. When I move it to production, i can't seem get it to work. On IIS i've configured the HTTP Response Headers to expire after 10 days. My web.config looks like so (again per the link above)
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="10.00:00:00"/>
</staticContent>
</system.webServer> </configuration>
Tried various things without success. The only possible lead i have at this point is from this thread
https://social.msdn.microsoft.com/Forums/vstudio/en-US/981bf691-ed6e-460a-9e99-af24fc8bfc0e/nodejsweb-apps-output-cache-not-working-for-node-web-app?forum=opensourcedevwithazure
but i have no idea how to make the suggested change in the web.config file. A couple of notes, im currently just running my node app in the command prompt like so: node app.js, not as node bin/www as suggested in the link (having some odd issues). Also, the site is still very much in development so on ssl. Read that chrome might have some issues with it, but the problem is present in all browser tested (chrome, firefox, etc...)

Umbraco Back Office not showing tree properly

I'm experiencing a strange issue with the umbraco back-office. The umbraco version is 7.5.3. Inside umbraco back-office when i try to open a node of Settings or Users tab , either templates, partialviews, stylesheets, etc, automatically a .aspx file is generated and downloaded and the node gets loading infinitely. For example clicking Create in templates a file create.aspx is generated and downloaded. Clicking in any of the templates a file EditView.aspx is generated and downloaded.
In chrome console appear the following:
jquery.min.js?cdv=865237568:3 Resource interpreted as Document but transferred with MIME type application/octet-stream: "http://localhost:54531/umbraco/settings/Views/EditView.aspx?treeType=templates&templateID=3289".
The same problem happen both in back-office local environment and back-office production environment. Fortunately the page in production has not problem but I can't access into the nodes into the back-office. Please, any help would be very appreciated. At the end, an image of the logs. Any other information required about the issue please let me know.
Tracking in version control I realized that I had deactivated the ImageProcessor module by commenting the following line in web.config:
<!--<add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" />-->
but this line:
<add name="StaticFileHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
which was added previously when I installed ImageProcessor.Web.Config also was necessary to comment it. so I commented too and the problem dissapeared.

web.config file not being read by Google PageSpeed Insights

I have read through answers here and still stuck: IIS7 Cache-Control
I have the following web.config.xml file in the root directory of my website:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00"/>
</staticContent>
</system.webServer>
</configuration>
The purpose of this web.config file is to pass the Google PageSpeed Insight 'leverage browser caching' test. I am using Windows Plesk hosting, and therefore cannot use a .htaccess file for this.
No matter how I try and format the contents of the web.config file, Google does not seem to recognise any form of browser caching is occurring. I am not sure if it is just Google, or if it means that the images and other static resources on my page are being cached or not. Is there an easy way to check this?
Can anyone see any issues with my web.config.xml contents that might be causing the issue? Or is there anything else I need to do with it other than stick it in the root directory of my site?
The file name should be web.config and not web.config.xml
*.config is already a xml type of file

MVC 3 Won't Serve Content files from Areas subfolder

I have an MVC3 application with a couple of areas and a portable area as well (using MVCContrib)
Normally, I keep all my content files under ~/Content and my scripts under ~/Scripts.
However, I am building a fairly complex webclient to another service on my site and I want to organize those javascript and image files (LOTS of image files and resources) under the Area's folder structure, which looks something like this, under ~/Areas/WebClient
Content
css
fonts
images
js
Controllers
Models
Views
I have a resource aggregator controller (one of my portable areas) that is able to reach into the CSS/JS folders just fine to provide that content. However, the CSS files reference the images/fonts folders directly and all of those links show up broken. I have double and triple checked the paths and made sure everything was right but I still get 404 errors.
As far as I know MVC3 is supposed to ignore routing so long as there's a static file there. Also, as far as I know, only the App_* folders enjoy special protection. What am I missing? I'd rather not mix in my images and resources with my main application if I can at all avoid it.
As an example: http://localhost/Areas/WebClient/Content/images/knownimage.png will not work, but should, as it exists!
So after some sleep and, more importantly, stepping away from the problem I remembered that MVC does in fact offer you protection from people downloading views directly, which led me to remember the Web.config file required in the Areas folder. Sure enough, there's an httphandler that basically sends all requests to the FileNotFound handler.
All I had to do was drop a web.config file in the content folder I wanted to expose with the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="BlockViewHandler" />
</handlers>
</system.webServer>
</configuration>
Problem solved.

server error:405 - HTTP verb used to access this page is not allowed

I have a php Facebook application which I have uploaded in a Microsoft server. When I run the application i get this error. Does anybody know the cause of this ?
405 - HTTP verb used to access this page is not allowed. The page you
are looking for cannot be displayed because an invalid method (HTTP
verb) was used to attempt access.
Even if you are using IIS or apache, in my guess you are using static html page as a landing page, and by default the web server doesn't allow POST or GET verb on .html page, facebook calls your page via POST/GET verb
the solution would be to rename the page into .php or .aspx
and you should be good to go :)
In the Facebook app control panel make sure you have a forward slash on the end of any specified URL if you are only specifying a folder name
i.e.
Page Tab URL: http://mypagetabserver.com/custom_tab/
you can add these lines to the web.config:
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
</system.webServer>
It means litraly that, your trying to use the wrong http verb when accessing some http content. A lot of content on webservices you need to use a POST to consume. I suspect your trying to access the facebook API using the wrong http verb.
I fixed mine by adding these lines on my IIS webconfig.
<httpErrors>
<remove statusCode="405" subStatusCode="-1" />
<error statusCode="405" prefixLanguageFilePath="" path="/my-page.htm" responseMode="ExecuteURL" />
</httpErrors>
I've been pulling my hair out over this one for a couple of hours also. fakeartist appears correct though - I changed the file extension from .htm to .php and I can now see my page in Facebook! It also works if you change the extension to .aspx - perhaps it just needs to be a server side extension (I've not tried with .jsp).
Try renaming the default file. In my case, a recent move to IIS7.5 gave the 405 error. I changed index.aspx to default.aspx and it worked immediately for me.
In my case, IIS was fine but.. uh.. all the files in the folder except web.config had been deleted (a manual deployment half-done on a test site).
I got this error when I was using jquery and lib was not present in the given path, once jquery lib is added back error was gone.
[File name - calculate.html]
I had this err on the host too (my project was .net core2.1 webapi )
please add this code in web config in host :
<modules>
<remove name="WebDAVModule" />
</modules>

Resources