determine programatically: Web or Windows?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • dje

    #1

    determine programatically: Web or Windows?

    How do I determine if the current process is a Web Application
    or Windows Application? I've tried:
    System.Diagnost ics.Process process=System. Diagnostics.Pro cess.GetCurrent Process();
    but it produces:
    Couldn't get process information from remote machine.
    Using W2K.
  • Alek Davis

    #2
    Re: determine programatically : Web or Windows?

    I am not sure whether this is "the proper" method, but you can try to check
    the value of System.Web.Http Context.Current and if it is null, you can
    conclude that it is not a Web application.

    Alek

    "dje" <de@networld.co m> wrote in message
    news:d7a9f187.0 312110812.5ccb4 65e@posting.goo gle.com...[color=blue]
    > How do I determine if the current process is a Web Application
    > or Windows Application? I've tried:
    > System.Diagnost ics.Process[/color]
    process=System. Diagnostics.Pro cess.GetCurrent Process();[color=blue]
    > but it produces:
    > Couldn't get process information from remote machine.
    > Using W2K.[/color]


    Comment

    • dje

      #3
      Re: determine programatically : Web or Windows?

      Thanks Alek; System.Web.Http Context is undefined for a windows app so
      that didn't quite work. "AppDomain.Curr entDomain.Frien dlyName" seems
      to work for me.

      "Alek Davis" <alek_xDOTx_dav is_xATx_intel_x DOTx_com> wrote in message news:<OEGjufAwD HA.2180@TK2MSFT NGP09.phx.gbl>. ..[color=blue]
      > I am not sure whether this is "the proper" method, but you can try to check
      > the value of System.Web.Http Context.Current and if it is null, you can
      > conclude that it is not a Web application.
      >
      > Alek
      >
      > "dje" <de@networld.co m> wrote in message
      > news:d7a9f187.0 312110812.5ccb4 65e@posting.goo gle.com...[color=green]
      > > How do I determine if the current process is a Web Application
      > > or Windows Application? I've tried:
      > > System.Diagnost ics.Process[/color]
      > process=System. Diagnostics.Pro cess.GetCurrent Process();[color=green]
      > > but it produces:
      > > Couldn't get process information from remote machine.
      > > Using W2K.[/color][/color]

      Comment

      • Rick Strahl [MVP]

        #4
        Re: determine programatically : Web or Windows?


        Well, then use System.Web.Http Context for your check <g>...

        +++ Rick ---

        --

        Rick Strahl
        West Wind Technologies


        ----------------------------------
        Making waves on the Web


        "dje" <de@networld.co m> wrote in message
        news:d7a9f187.0 312181924.2d648 8ed@posting.goo gle.com...[color=blue]
        > Thanks Alek; System.Web.Http Context is undefined for a windows app so
        > that didn't quite work. "AppDomain.Curr entDomain.Frien dlyName" seems
        > to work for me.
        >
        > "Alek Davis" <alek_xDOTx_dav is_xATx_intel_x DOTx_com> wrote in message[/color]
        news:<OEGjufAwD HA.2180@TK2MSFT NGP09.phx.gbl>. ..[color=blue][color=green]
        > > I am not sure whether this is "the proper" method, but you can try to[/color][/color]
        check[color=blue][color=green]
        > > the value of System.Web.Http Context.Current and if it is null, you can
        > > conclude that it is not a Web application.
        > >
        > > Alek
        > >
        > > "dje" <de@networld.co m> wrote in message
        > > news:d7a9f187.0 312110812.5ccb4 65e@posting.goo gle.com...[color=darkred]
        > > > How do I determine if the current process is a Web Application
        > > > or Windows Application? I've tried:
        > > > System.Diagnost ics.Process[/color]
        > > process=System. Diagnostics.Pro cess.GetCurrent Process();[color=darkred]
        > > > but it produces:
        > > > Couldn't get process information from remote machine.
        > > > Using W2K.[/color][/color][/color]


        Comment

        Working...