使用我的 MembershipProvider 访问 RequestContext
是否有比以下更简单/更好的方法从自定义成员资格提供程序中访问 RequestContext(此外,此方法是否有效):
private static RequestContext GetRequestContext()
{
HttpContextBase contextBase =
new HttpContextWrapper(HttpContext.Current);
return new RequestContext(
contextBase,
RouteTable.Routes.GetRouteData(contextBase));
}
Is there an easier/better way to access the RequestContext from within a custom Membership Provider than the following (and further, will this method even work):
private static RequestContext GetRequestContext()
{
HttpContextBase contextBase =
new HttpContextWrapper(HttpContext.Current);
return new RequestContext(
contextBase,
RouteTable.Routes.GetRouteData(contextBase));
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 @Aliostad 提到的:使用
HttpContext.Current.Request
代替。他不会重新发布他的评论作为答案,所以......As @Aliostad mentioned: use
HttpContext.Current.Request
instead. He wouldn't repost his comment as an answer, so ...