How to find out if the current application is an ASP.NET web app

后端 未结 4 1110
Happy的楠姐
Happy的楠姐 2021-02-01 08:05

From a managed class library, I\'d like to find out whether the currently executing application is an ASP.NET web application (web forms or MVC) or not.

I have seen diff

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-01 08:44

    I have to question your goal here: Why should the library be aware of what kind of application it is running from?

    To me, it sounds like you need to split the relevant part of your library in two parts - one for use with web apps, and one for use with winforms apps. (And possibly a third part, with everything that can be used by both types of apps...)

提交回复
热议问题