Customizing ASP.NET Membership Provider to add logging capabilities

做~自己de王妃 提交于 2019-12-23 05:25:56

问题


I need to slightly tweak the functionality of the ASP.NET Membership provider to add custom logging functionality. Instead of creating a wrapper class around the methods I wish to modify, I was toying with the idea or creating a custom Membership Provider and override a few of the methods.

All the examples I could find would show how to create it from scratch. I don't want to overwrite everything... just override a few methods. Can somebody point me in the right direction?

Thanks!

EDIT: DOH! I can simply inherit from SqlMembershipProvider and override the methods. However, how can I get at the connection string?


回答1:


What is it that you are trying to log?

If you simply want to monitor success and failure of authentication, ASP.NET Health Monitoring is already in the box. Events are logged to the WebEvent tables.

If you have other motives, well then..... ;-)


to answer your question about the connection string, override Initialize and capture the value from the config argument before calling base.Initialize



来源:https://stackoverflow.com/questions/3737260/customizing-asp-net-membership-provider-to-add-logging-capabilities

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