Advertisement
orilon

C# Check if dll is used in web/windows

Jun 4th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.27 KB | None | 0 0
  1. using System.Web;
  2.  
  3. private static bool IsWebApp()
  4. {
  5.     return (HttpContext.Current != null);
  6. }
  7.  
  8. /// you can call this check in your constructor, or where ever.
  9. if (IsWebApp())
  10. {
  11.     /// ... your code here for web
  12. }
  13. else
  14. {
  15.     /// ... your code here for windows/winforms
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement