Dim context As HttpContext = HttpContext.Current

Discussion in 'ASP .Net Web Controls' started by Tony, Mar 2, 2004.

  1. Tony

    Tony Guest

    Hi there,

    I reference namespace and imports System.Web on my spcifice class and then
    I declared:

    Dim context As HttpContext = HttpContext.Current

    I always got httpcontext is not defined. Any suggestion would be
    appreciated.

    Sandra
     
    Tony, Mar 2, 2004
    #1
    1. Advertising

  2. Tony

    SB Guest

    Hello Sandra
    You don't need to create an instance of the class. You can use its static
    methods straight away.
    Selim
    "Tony" <> wrote in message
    news:...
    > Hi there,
    >
    > I reference namespace and imports System.Web on my spcifice class and

    then
    > I declared:
    >
    > Dim context As HttpContext = HttpContext.Current
    >
    > I always got httpcontext is not defined. Any suggestion would be
    > appreciated.
    >
    > Sandra
    >
    >
    >
    >
     
    SB, Mar 3, 2004
    #2
    1. Advertising

  3. Tony

    Teemu Keiski Guest

    Hi,

    do you use the class in conjuction with web request for example Page uses it
    or such? HttpContext exists only in web context so it cannot be used outside
    of it. Where are you using this line of code, show some more code.

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist


    "Tony" <> wrote in message
    news:...
    Hi there,

    I reference namespace and imports System.Web on my spcifice class and then
    I declared:

    Dim context As HttpContext = HttpContext.Current

    I always got httpcontext is not defined. Any suggestion would be
    appreciated.

    Sandra
     
    Teemu Keiski, Mar 3, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. memememe

    HttpContext.Current

    memememe, Jul 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    368
    Natty Gur
    Jul 20, 2003
  2. nalbayo
    Replies:
    2
    Views:
    5,599
    Bruce Barker
    Nov 11, 2005
  3. Denis Palas
    Replies:
    1
    Views:
    531
  4. Florian Kaufmann
    Replies:
    1
    Views:
    392
  5. J-T
    Replies:
    1
    Views:
    300
    Dominick Baier [DevelopMentor]
    Jul 14, 2005
Loading...

Share This Page