Search code examples
asp.netmembership-providerrequestcontext

Accessing RequestContext from with my MembershipProvider


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));
    }

Solution

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