HttpWebRequest question

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

    HttpWebRequest question

    Hi,

    I am unsure as to what the proper usage model for HttpWebRequest is.

    Do I create a new request instance each time I interact with a specific
    server?

    For example, if I need to perform a GET, then a POST, and then another GET,
    do I use the same HttpWebRequest instance, or do I continually create new
    instances and repopulate each one (e.g. cookies)?

    Thanks,
    tj


  • Scott Allen

    #2
    Re: HttpWebRequest question

    Hi tj:

    You can create new instances for each request. Create a single CookieContainer
    and assign it to the Cookies property of each instance to keep the cookies
    in synch.

    HTH,

    --
    Scott

    [color=blue]
    > Hi,
    >
    > I am unsure as to what the proper usage model for HttpWebRequest is.
    >
    > Do I create a new request instance each time I interact with a
    > specific server?
    >
    > For example, if I need to perform a GET, then a POST, and then another
    > GET, do I use the same HttpWebRequest instance, or do I continually
    > create new instances and repopulate each one (e.g. cookies)?
    >
    > Thanks,
    > tj[/color]


    Comment

    Working...