HTTP 404 file not found error even the file exist in the webserver IIS6.0 - iis-6

I am having files in the server to be available for downloads. I am using IIS6.0. When I try to download the pdf file it say Http 404 file not found error. But I am having the file in the server. While googling I found we need to enable the mime type. can any one explain me what is it and get rid of this problem

This is easy enough to sort out
To enable globally on the all site hosted by this IIS instance
Open IIS Manager
Right Click the server name
Select properties
Click the MIME Types button
Click New
Extension is .pdf
MIME type is application/pdf
To add it only to a single site on the IIS instance
Open IIS Manager
Right Click the sites name
Select Properties
Choose the 'HTTP Headers' tab
Click the MIME Types button
Click New
Extension is .pdf
MIME type is application/pdf

Open Internet Information Service(IIS) Manager
Right click on your website
Select HTTP Header tab
You will find button to add MIME Types
This link might be helpful to you.

You will find help in the Microsoft Knowledge Base: http://support.microsoft.com/kb/326965

Related

How to access Images in folder in Express and not downloading them

app.use("/uploads", express.static("./server/uploads"));
Everytime I access http://localhost:4500/uploads/16562754008013gncm1.jfif , it automatically downloads
-index.js
-server
----uploads
-------16562754008013gncm1.jfif
Folder Structure in Express
It may be that part of your problem is that .jfif is perhaps a file extension that Express and the browser don't know and recognize so the only thing a browser knows to do with it is offer a download dialog in the browser. You can verify this by looking in the network tab of the Chrome/Edge or Firefix inspector and look at what the content-type is set to when the response comes back from the server.
If Express recognizes the file extension, it will set the appropriate content-type. And, if the browser recognizes the content-type, it will treat it appropriately. If not, Express will set a generic content-type and the browser won't know what to do with it other than offering a download dialog.
You can fix that by either giving the file a file extension that is generally known that corresponds to its actual type or you can manually override and set the content-type (if that content-type is something that the browser recognizes).

Server side: detecting if a user is downloading (save as...) or visualizing a file in the browser

I'm writing an apache2 module
by default and when viewed in a web browser, the module would only print the first lines of a large file and convert them to HTML.
if the user choose to 'download as...', the whole raw file would be downloaded.
Is it possible to detect this choice on the server side ? (for example is there a specific http header set ?).
note: I would like to avoid any parameter in the GET url (e.g: "http://example.org/file?mode=raw" )
Pierre
added my own answer to close the question: as said #alexeyten there is no difference. I ended by a javascript code the alter the index.html file generated by apache.

Problem with opening pdf file in site

I have pdf file in serwer and link to it. In local host when i click on link pdf file display in site. On server I've got popup with asking to download file. How to change type from application/octet-stream to application/pdf to display pdf normal on site?
Here is screen after clicking on link:
The reason that the listed solutions are reported not to work half the time, is because using the default MIME association or setting the Content-Type header in <Files> or <FilesMatch> (for the PDF file extension) will have no effect on PDF files that are dynamically transferred via PHP code (i.e., readfile())...
To force a PDF to open in the browser rather than downloading, you should use LocationMatch instead:
<LocationMatch "\.(?i:pdf)$">
ForceType application/pdf
Header set Content-Disposition inline
</LocationMatch>
This way it picks up on transfers that are not direct from the file-system.
If it a unix server add an entry for pdfs in /etc/mime.types, if it's a Windows server, add a mime type in IIS.
Problem solved with using solution from this site:
http://www.thingy-ma-jig.co.uk/blog/06-08-2007/force-a-pdf-to-download
Thanks Joost Evertse

PUT and DELETE getting 404 in WCF REST service .net 4 when running in IIS 6.0

I've added the wildcard application mapping for c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll and unchecked the "verify that file exist" checkbox. This gives me GET and POST ability but not PUT and DELETE.
I have both prohibited and allowed WebDav under the web service extensions.
Application works like a champ when running in development environment. PUT and DELETE don't work when running app in IIS.
Any help is appreciated.
Have you defined the extra verbs in the ISAPI extension that is linked to WCF? To do this, open up IIS and edit the properties of the website. From their click on the Home Directory tab, and then the configuration button. In the mappings tab find the appropriate extensions, and double click it. In the new window you will find a field called "Limit To" which should have the HTTP Verbs you wish to use defined.
Old Question but worth a potential solution:
Check you don't have http://www.iis.net/downloads/microsoft/urlscan installed, by default it disallows PUT and DELETE amongst other verbs.

Enable PUT on WCF REST Api on IIS 6 (without .svc file)

On IIS 6 how can I allow the PUT operation on a WCF Rest API?
Since I don't have the .svc file (I added a route on global.asax to service class) I can't allow the put operation on the .svc extension on IIS 6.
Open the IIS Management console,
Right click on your website in the sidebar and go to properties.
Go to the "Home Directory" Tab
Click on the "configuration" button
Add a wildcard mapoping to your isapi.dll (you can copy and paste from the top window). Uncheck the "verify file exists" checkbox
Other solution suggest changing the verbs for a given extension, but if you don't have one thne this wildcard thing works.
There may be a better way of course but it works for us
PUT verb for us would not work when calling the API via CURL for testing yet other verbs were ok.
REST API
Windows 2003 Server x64 standard edition
IIS6
.net 4.0 framework
For us the solution was:
open MMC and connect to IIS6
right click website and properties
select home directory
configuration
select the file extension you are using
EDIT
Either "allow all verbs" or add "PUT" to the "Limit to" list.
Apply
Hope that helps someone.
(please note i tried the WILDCARD suggestion below but did not resolve our issue)