Passing HttpContext reference as an input parameter

Discussion in 'ASP .Net' started by josephpage@gmail.com, Apr 13, 2005.

  1. Guest

    I have a Visitor class that is defined in a class library.
    The class has lots of parameters that are pulled from the QueryString,
    the ReferrerUrl, Cookies, the Session object, etc...

    I would like to make a constructor for the Visitor class that accepts
    an HttpContext instance from within Session_Start in Global.asax.cs as
    an input parameter.

    The problem is that I can't figure out how to reference HttpContext
    from within my Visitor class.

    System.Web has a reference to HttpContext within Global.asax.cs, but
    not from within the class library that contains the Visitor class

    I only need to read the information in the HttpContext if the issue
    revolves around not being able to manipulate HttpContext information
    outside the ASP.Net project.

    Thank you for any insights,

    Joe
     
    , Apr 13, 2005
    #1
    1. Advertising

  2. Karl Seguin Guest

    Have you tried looking at HttpContext.Current ?

    dim current as HttpContext = HttpContext.Current
    current.Request...

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    <> wrote in message
    news:...
    > I have a Visitor class that is defined in a class library.
    > The class has lots of parameters that are pulled from the QueryString,
    > the ReferrerUrl, Cookies, the Session object, etc...
    >
    > I would like to make a constructor for the Visitor class that accepts
    > an HttpContext instance from within Session_Start in Global.asax.cs as
    > an input parameter.
    >
    > The problem is that I can't figure out how to reference HttpContext
    > from within my Visitor class.
    >
    > System.Web has a reference to HttpContext within Global.asax.cs, but
    > not from within the class library that contains the Visitor class
    >
    > I only need to read the information in the HttpContext if the issue
    > revolves around not being able to manipulate HttpContext information
    > outside the ASP.Net project.
    >
    > Thank you for any insights,
    >
    > Joe
    >
     
    Karl Seguin, Apr 14, 2005
    #2
    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. Guest
    Replies:
    0
    Views:
    405
    Guest
    Oct 25, 2007
  2. Isti
    Replies:
    2
    Views:
    760
  3. Mister B
    Replies:
    8
    Views:
    599
    Nick Keighley
    Aug 26, 2010
  4. Tony

    Dim context As HttpContext = HttpContext.Current

    Tony, Mar 2, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    347
    Teemu Keiski
    Mar 3, 2004
  5. Guest

    Passing collection as input parameter to web service

    Guest, Oct 21, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    195
    Dan Rogers
    Nov 12, 2004
Loading...

Share This Page