More Glory

I'd like to tell about my thoughts (which may be interesting to others), about places where I've been.

Tuesday, 29 January 2013

How to execute different code if your .NET component is used within web application

I've just discovered a tiny workaround helping me to execute different code inside of .NET component if it is used within a web application:

bool webMode = (System.Web.HttpContext.Current != null);

if (webMode)
{
    // code for web application
}
else
{
    // code for all other types of apps
}

Probably it has some drawbacks and hidden pitfalls but so far it works well...

Posted by Unknown at 09:40 No comments:
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Blog Archive

  • ►  2014 (4)
    • ►  April (2)
    • ►  February (2)
  • ▼  2013 (3)
    • ►  December (1)
    • ►  March (1)
    • ▼  January (1)
      • How to execute different code if your .NET compone...
  • ►  2012 (2)
    • ►  August (1)
    • ►  May (1)
  • ►  2011 (8)
    • ►  December (2)
    • ►  September (1)
    • ►  August (3)
    • ►  January (2)
  • ►  2010 (10)
    • ►  October (2)
    • ►  August (2)
    • ►  June (1)
    • ►  May (3)
    • ►  April (1)
    • ►  March (1)
  • ►  2009 (8)
    • ►  October (2)
    • ►  September (1)
    • ►  August (1)
    • ►  July (1)
    • ►  June (1)
    • ►  March (1)
    • ►  February (1)
  • ►  2008 (15)
    • ►  December (1)
    • ►  November (7)
    • ►  October (5)
    • ►  September (2)
  • ►  2007 (1)
    • ►  April (1)

About Me

Unknown
View my complete profile
Simple theme. Powered by Blogger.