Log file is not being written to from an HttpHandler

微笑、不失礼 提交于 2019-11-29 15:25:20
<httpHandlers>
   <add verb="" path=".jpg" type="MyHandler.NewHandler,MyHandler"/>
</httpHandlers> 

Is this just a layout problem of stackoverflow or did you omit the asterisk (*):

<httpHandlers>
   <add verb="*" path="*.jpg" type="MyHandler.NewHandler,MyHandler"/>
</httpHandlers> 

If it's not missing asterisk, I would try to see the Network tab in Firebug on Firefox (or use Fiddler - a http debugging proxy). What HTTP response code do you get from the call?

Does the user your application is running under have access to C:\? That's usually not the case; allowing an application context access to the root directory presents a big security risk.

Instead create a specific directory, for example c:\logs and give the ASP.NET application pool's user account full rights to that directory alone.

Check your permissions.

You didn't hear this from me, but give "Everyone" full control to your C: and then run your test and see if the log file is created. (Right mouse click on C:, Properties, Security tab, etc...)

Don't forget to remove the permission when done.

Giving "Everyone" full control is just testing whether you're running into a permissions issue. If true, than you can fix it properly.

Don't forget to remove the permission when done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!