How determine if application is web application

后端 未结 5 1438
轻奢々
轻奢々 2020-11-29 06:39

In a core assembly, which is run both in a windows service, and in a web application, I need to store information per user session. The service will have a single user sessi

5条回答
  •  难免孤独
    2020-11-29 07:07

    If possible I'd suggest having it as an input parameter to some initialize method in the class library that would need to be called before the class library can be used.

    If that's not an option I'd look at HttpRuntime.Cache which I think would be non null even if HttpRuntime.Current is null. I'm not a webforms guy but I remember someone mentioning that for a similar question sometime somewhere (can't find that question now).

提交回复
热议问题