How do I determine if the executing assembly is a web app or winform/console?

后端 未结 5 1653
灰色年华
灰色年华 2021-01-18 02:14

I would like to write a helper function which build the exception message to write to a log. The code look like:

if(IsWebApp)
{

    &

5条回答
  •  礼貌的吻别
    2021-01-18 03:05

    How about

    If (Not System.Web.HttpContext.Current Is Nothing) Then
    
    End If
    

    or

    if(System.Web.HttpContext.Current != null){
    
    }
    

提交回复
热议问题