自定义 ASP.NET Membership Provider 以添加日志记录功能
我需要稍微调整 ASP.NET 会员资格提供程序的功能以添加自定义日志记录功能。我没有围绕我想要修改的方法创建包装类,而是尝试这个想法或创建一个自定义成员资格提供程序并重写一些方法。
我能找到的所有示例都会展示如何从头开始创建它。我不想覆盖所有内容...只需覆盖一些方法。有人能指出我正确的方向吗?
谢谢!
编辑: 卫生部!我可以简单地继承 SqlMembershipProvider 并重写这些方法。但是,如何获取连接字符串?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在尝试记录什么?
如果您只是想监控身份验证的成功和失败,ASP.NET 运行状况监控< /a> 已在框中。事件记录到 WebEvent 表中。
如果您有其他动机,那么......;-)
要回答有关连接字符串的问题,请覆盖
Initialize
并在调用base.Initialize 之前从配置参数中捕获值
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 callingbase.Initialize