1

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));
    }
skaffman
  • 398,947
  • 96
  • 818
  • 769
Scott Baker
  • 10,013
  • 17
  • 56
  • 102
  • 1
    Why do you do this? Can't you use `HttpContext.Current.Request`? – Aliostad Jan 13 '11 at 23:08
  • @Aliostad: It would appear that I can indeed - I don't know what I wasn't seeing that made me want to do it the hard way. Post this as an answer and I'll accept it. – Scott Baker Jan 19 '11 at 00:05

1 Answers1

2

As @Aliostad mentioned: use HttpContext.Current.Request instead. He wouldn't repost his comment as an answer, so ...

Scott Baker
  • 10,013
  • 17
  • 56
  • 102