views:

157

answers:

1

Is there any potential pitfall for using HttpContext.Current.CurrentHandler for runtime view access?

public static GetView<T>(T view) where T : IView
{
    return  HttpContext.Current.CurrentHandler as T;
}
+1  A: 

I don't think so, as long as you're aware that it can be null.

SLaks
Accepting this since no one offered any dissenting opinion.
Chris Marisic