Tell rather what happens. My guess is that this type is not known to your library and anyway it would be not the same type in all and every web app. A quick fix might to check the base type ie:
if (this is System.Web.HttpApplication) // do whatever... global_asax should inherit from HttpApplication
For a better suggestion we would need to understand the purpose of testing ithis (what if called from ASP.NET Core, from a Windows service and so on ?), maybe injecting a dependency suitable for the current environment??
All-Star
48660 Points
18169 Posts
Re: ASP.global_asax Type
Dec 29, 2019 09:43 AM|PatriceSc|LINK
Hi,
Tell rather what happens. My guess is that this type is not known to your library and anyway it would be not the same type in all and every web app. A quick fix might to check the base type ie:
if (this is System.Web.HttpApplication) // do whatever... global_asax should inherit from HttpApplication
For a better suggestion we would need to understand the purpose of testing ithis (what if called from ASP.NET Core, from a Windows service and so on ?), maybe injecting a dependency suitable for the current environment??