Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. HTTPWebRequest class

HTTPWebRequest class

Scheduled Pinned Locked Moved C#
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AssemblySoft
    wrote on last edited by
    #1

    I am currently using the HTTPWebRequest class. I need to add the following to the request line: POST /Search HTTP/1.1 It is simple to get 'POST HTTP/1.1' but i am having difficulty adding the additional string. I cannot seem to get the '/Search' inserted in the request line. I understand HTTP 1.1 and the VERBS allowed as part of a request. The 'method' property is used to set the VERB. Adding anything other than a single string throws a null reference exception. I have seen extra information appended to the method many times in the past so not too sure why this is so problematic. I initially thought of overriding the HTTPWebRequest but as it is created from calling Create() on the WebRequest, this doesn't appear possible. Thanks in advance. Carl

    C 1 Reply Last reply
    0
    • A AssemblySoft

      I am currently using the HTTPWebRequest class. I need to add the following to the request line: POST /Search HTTP/1.1 It is simple to get 'POST HTTP/1.1' but i am having difficulty adding the additional string. I cannot seem to get the '/Search' inserted in the request line. I understand HTTP 1.1 and the VERBS allowed as part of a request. The 'method' property is used to set the VERB. Adding anything other than a single string throws a null reference exception. I have seen extra information appended to the method many times in the past so not too sure why this is so problematic. I initially thought of overriding the HTTPWebRequest but as it is created from calling Create() on the WebRequest, this doesn't appear possible. Thanks in advance. Carl

      C Offline
      C Offline
      ChrisKo 0
      wrote on last edited by
      #2

      As far as I know, you only have access to the Headers collection on the HttpWebRequest. You will probably need to write your own class for this functionality. Luckily, you can use this post as a basis for getting that done. http://www.thescripts.com/forum/thread343158.html[^] Good luck.

      A 1 Reply Last reply
      0
      • C ChrisKo 0

        As far as I know, you only have access to the Headers collection on the HttpWebRequest. You will probably need to write your own class for this functionality. Luckily, you can use this post as a basis for getting that done. http://www.thescripts.com/forum/thread343158.html[^] Good luck.

        A Offline
        A Offline
        AssemblySoft
        wrote on last edited by
        #3

        Hi Mike, thanks for the post. I did something very similar already as a back up to the problem, using the TCPClient and NetworkStream. Created an additional HttpProtocol class and added all the members that might be needed. provided an override of ToString with booleans against each of the properties as to whether to include them in the ToString. Feels so cludgy though. plus it's a real pain interrogating the response headers and content. as it just comes back as a byte array. still think there must be a better way. thanks. Carl

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups