No context for HttpContext in class

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

    #1

    No context for HttpContext in class

    This is a C# web app.

    The Object HTTPContext is not available in my class. I need to grab an
    instance of the Current context with something like:

    HTTPContext c = HTTPContext.Cur rent;

    The problem is, HTTPContext is not available to my intellisence, even
    though I have System.Web above. This is a class object which a web
    class form would be utilizing, but am stuck with no context (no
    intellisence).

    Any idea what might be wrong?
  • KJS

    #2
    Re: No context for HttpContext in class

    Ok, let me throw out an important piece: the class which I need the
    current context is of another project. So I have somthing like:

    mySolution
    webAppProject
    default.cs
    myUtilitiesProj ect
    myXMLParser.cs
    myDatabaseClass .cs

    So, I need Current context across projects. Is this possible?

    Karl..


    In article <MPG.1e12a08fd6 e1ca80989684@ne ws.cox.net>,
    karlstubsjoen@h otmail.com says...[color=blue]
    > This is a C# web app.
    >
    > The Object HTTPContext is not available in my class. I need to grab an
    > instance of the Current context with something like:
    >
    > HTTPContext c = HTTPContext.Cur rent;
    >
    > The problem is, HTTPContext is not available to my intellisence, even
    > though I have System.Web above. This is a class object which a web
    > class form would be utilizing, but am stuck with no context (no
    > intellisence).
    >
    > Any idea what might be wrong?
    >[/color]

    Comment

    • KJS

      #3
      Re: No context for HttpContext in class

      This is a big fat NEVERMIND! I figured it out, just needed to add the
      reference to the project for System.Web.DLL

      Dohhh!

      (maybe this helps someone else)

      In article <MPG.1e12a1c0f7 2d99f6989685@ne ws.cox.net>,
      karlstubsjoen@h otmail.com says...[color=blue]
      > Ok, let me throw out an important piece: the class which I need the
      > current context is of another project. So I have somthing like:
      >
      > mySolution
      > webAppProject
      > default.cs
      > myUtilitiesProj ect
      > myXMLParser.cs
      > myDatabaseClass .cs
      >
      > So, I need Current context across projects. Is this possible?
      >
      > Karl..
      >
      >
      > In article <MPG.1e12a08fd6 e1ca80989684@ne ws.cox.net>,
      > karlstubsjoen@h otmail.com says...[color=green]
      > > This is a C# web app.
      > >
      > > The Object HTTPContext is not available in my class. I need to grab an
      > > instance of the Current context with something like:
      > >
      > > HTTPContext c = HTTPContext.Cur rent;
      > >
      > > The problem is, HTTPContext is not available to my intellisence, even
      > > though I have System.Web above. This is a class object which a web
      > > class form would be utilizing, but am stuck with no context (no
      > > intellisence).
      > >
      > > Any idea what might be wrong?
      > >[/color]
      >[/color]

      Comment

      • Ignacio Machin \( .NET/ C# MVP \)

        #4
        Re: No context for HttpContext in class

        hi,

        nice monologue :)

        glad you find the solution though.


        --
        Ignacio Machin,
        ignacio.machin AT dot.state.fl.us
        Florida Department Of Transportation

        "KJS" <karlstubsjoen@ hotmail.com> wrote in message
        news:MPG.1e12a2 e8cf46e7c098968 6@news.cox.net. ..[color=blue]
        > This is a big fat NEVERMIND! I figured it out, just needed to add the
        > reference to the project for System.Web.DLL
        >
        > Dohhh!
        >
        > (maybe this helps someone else)
        >
        > In article <MPG.1e12a1c0f7 2d99f6989685@ne ws.cox.net>,
        > karlstubsjoen@h otmail.com says...[color=green]
        >> Ok, let me throw out an important piece: the class which I need the
        >> current context is of another project. So I have somthing like:
        >>
        >> mySolution
        >> webAppProject
        >> default.cs
        >> myUtilitiesProj ect
        >> myXMLParser.cs
        >> myDatabaseClass .cs
        >>
        >> So, I need Current context across projects. Is this possible?
        >>
        >> Karl..
        >>
        >>
        >> In article <MPG.1e12a08fd6 e1ca80989684@ne ws.cox.net>,
        >> karlstubsjoen@h otmail.com says...[color=darkred]
        >> > This is a C# web app.
        >> >
        >> > The Object HTTPContext is not available in my class. I need to grab an
        >> > instance of the Current context with something like:
        >> >
        >> > HTTPContext c = HTTPContext.Cur rent;
        >> >
        >> > The problem is, HTTPContext is not available to my intellisence, even
        >> > though I have System.Web above. This is a class object which a web
        >> > class form would be utilizing, but am stuck with no context (no
        >> > intellisence).
        >> >
        >> > Any idea what might be wrong?
        >> >[/color]
        >>[/color][/color]


        Comment

        Working...