c# - Use cs file as Web handler -
i want ascx.cs
file work ashx
file reason. have implemented system.web.ihttphandler
, registered handler in web.config
<httphandlers> . . . <add path="*.cs" verb="*" type="namespace.classname, assembly.dll" validate="false" /> </httphandlers>
and added following code in request filtering under system.webserver
in `web.config'
<security> <requestfiltering> <fileextensions allowunlisted="true"> <remove fileextension=".cs" /> <add fileextension=".cs" allowed="true" /> </fileextensions> </requestfiltering> </security>
but when open .cs
file browser, gives me error.
http error 404.3 - not found
the page requesting cannot served because of extension configuration. if page script, add handler. if file should downloaded, add mime map.
with following details
module staticfilemodule
notification executerequesthandler
handler staticfile
error code 0x80070032
requested url http://localhost:80/myclass.ascx.cs
physical path mypath
logon method anonymous
logon user anonymous
you have add separate section static files, see here iis7, web.config allow static file handler in directory /uploads of website different want, static file concept shown.
Comments
Post a Comment