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. Web Development
  3. ASP.NET
  4. WebClient method and browser giving different response

WebClient method and browser giving different response

Scheduled Pinned Locked Moved ASP.NET
xmljsonhelpquestionannouncement
4 Posts 3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi my fellow coders, I'm trying to HTTP POST some data to a URL (API). If I directly try on the browser, it works fine and giving the below response: <?xml version="1.0" encoding="utf-8" ?> <OUTPUT> <STATUS>ERROR</STATUS> </OUTPUT> But If I use webclient class, the response is different, and is not posting the data at all: <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100 <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS> </OUTPUT> Can my fellow experts give ma a hint on how should I mimic the browser results?

    N A 2 Replies Last reply
    0
    • L Lost User

      Hi my fellow coders, I'm trying to HTTP POST some data to a URL (API). If I directly try on the browser, it works fine and giving the below response: <?xml version="1.0" encoding="utf-8" ?> <OUTPUT> <STATUS>ERROR</STATUS> </OUTPUT> But If I use webclient class, the response is different, and is not posting the data at all: <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100 <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS> </OUTPUT> Can my fellow experts give ma a hint on how should I mimic the browser results?

      N Offline
      N Offline
      nitin_vatsus
      wrote on last edited by
      #2

      Give me code by that you are calling web service you are missing something. You can also do remote debugging for your web service by that you found exact problem for remote debugging just attach process by which you are calling your web service if that is different machine then run webserive and put break point into web service when client call web service automatically execution stop on your break point.

      1 Reply Last reply
      0
      • L Lost User

        Hi my fellow coders, I'm trying to HTTP POST some data to a URL (API). If I directly try on the browser, it works fine and giving the below response: <?xml version="1.0" encoding="utf-8" ?> <OUTPUT> <STATUS>ERROR</STATUS> </OUTPUT> But If I use webclient class, the response is different, and is not posting the data at all: <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100 <?xml version="1.0" encoding="utf-8"?> <OUTPUT><STATUS>SUCCESS</STATUS></OUTPUT></STATUS> </OUTPUT> Can my fellow experts give ma a hint on how should I mimic the browser results?

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Member 2102804 wrote:

        If I directly try on the browser, it works fine and giving the below response:

        ERROR

        How did you try on browser ?

        Member 2102804 wrote:

        But If I use webclient class, the response is different, and is not posting the data at all:

        HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100

        SUCCESS

        You want to mean, when you are posting the file from your client application ?

        cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article

        L 1 Reply Last reply
        0
        • A Abhijit Jana

          Member 2102804 wrote:

          If I directly try on the browser, it works fine and giving the below response:

          ERROR

          How did you try on browser ?

          Member 2102804 wrote:

          But If I use webclient class, the response is different, and is not posting the data at all:

          HTTP/1.0 200 OK Content-Type: text/xml Content-Length: 100

          SUCCESS

          You want to mean, when you are posting the file from your client application ?

          cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net View My Recent Article

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi... Thank you for your response, FYI, it's not a webservice, it's a normal HTTP URL Trying on browser, means typing the url in the browser's address, click below to try http://gateway.ionnex.com:8001/sendsms.aspx[^] (note this is not the url I'm testing as that url is only accesible via my server) And I'm not posting file, just parameters and values. I believe my client application is bug free as it works for other URL (API) but not this one, seems it's giving me the HTTP 200 status instead of the status from the server.

          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