Determine current execution context (ASP.NET or Winforms)

5 10 2007

I’ve moved my blog to a self-hosted account.
So, you can see this post at http://www.logue.com.ar/blog/2007/10/determine-current-execution-context-webforms-or-winforms.

Thanks for the support!


Actions

Information

3 responses

5 05 2008
jamesgoody

Hey! Thanks for the tip. I was using HttpContext.Current but found that it was null when invoking methods via reflection. Using Assembly.GetEntryAssembly() allows for this scenario. I combined the two checks to be safe:

if (Assembly.GetEntryAssembly() != null && HttpContext.Current == null)

Thanks again!

Jimmy

13 12 2008
Fniitmse

Thanks!,

26 03 2009
Determine current execution context (ASP.NET or Winforms) « Technical Issues & Solutions

[…] Got the solution from Leandro’s blog post […]




%d bloggers like this: