1

I have an ASP.net web site that allows users to upload files to an upload folder on the server. The site is served by IIS 7.

I have configured the upload folder to not execute any script files that are requested, but how can I configure IIS 7 to serve these files as it would any other static file ONLY for this folder?

Thanks

EDIT

Here is what I have in the Handler Mappings for my upload folder:

Handler Mappings

Here is the web.config for the folder:

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers accessPolicy="Read"> <remove name="TRACEVerbHandler" /> <remove name="OPTIONSVerbHandler" /> <remove name="SimpleHandlerFactory-Integrated" /> <remove name="SSINC-shtml" /> <remove name="ScriptHandlerFactory" /> <remove name="SimpleHandlerFactory-ISAPI-2.0" /> <remove name="HttpRemotingHandlerFactory-soap-Integrated" /> <remove name="AXD-ISAPI-2.0" /> <remove name="ASPClassic" /> <remove name="AssemblyResourceLoader-Integrated" /> <remove name="HttpRemotingHandlerFactory-rem-Integrated" /> <remove name="PageHandlerFactory-Integrated" /> <remove name="ScriptResource" /> <remove name="SSINC-shtm" /> <remove name="WebServiceHandlerFactory-ISAPI-2.0" /> <remove name="SSINC-stm" /> <remove name="ISAPI-dll" /> <remove name="PageHandlerFactory-ISAPI-2.0" /> <remove name="ScriptHandlerFactoryAppServices" /> <remove name="SecurityCertificate" /> <remove name="TraceHandler-Integrated" /> <remove name="UrlRoutingHandler" /> <remove name="WebAdminHandler-Integrated" /> <remove name="MvcHttpHandler" /> <remove name="HttpRemotingHandlerFactory-soap-ISAPI-2.0" /> <remove name="HttpRemotingHandlerFactory-rem-ISAPI-2.0" /> <remove name="CGI-exe" /> </handlers> </system.webServer> </configuration> 

And here is what I get if I request an aspx file that is in my upload folder:

Server Error 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

0

2 Answers 2

1

I had to add a mime type for the file that I want to serve.

I used * to serve unknown file types as application/octet-stream.

0

You probably want a web.config file in this directory that un-maps all the handlers and map "*" to static:

 <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> 
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.