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. how to pass paramters in an httprequest

how to pass paramters in an httprequest

Scheduled Pinned Locked Moved C#
sysadmintutorialquestion
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.
  • P Offline
    P Offline
    priy
    wrote on last edited by
    #1

    Hi, I have created a webservice and on the client side i want to access it using Httprequest and httpresponse classes. There are two methods in that webservice.1 method returns a string.the 2nd method requires two integers as input parameters.how do i pass these parameters in the request from the client. call to Merthod1 from client:

    HttpWebRequest myreq = (HttpWebRequest)WebRequest.Create("http://localhost:2054/my\_ws/MY\_WebService.asmx/HelloWorld");
    myreq.Method = "POST";
    myreq.ContentType = "application/x-www-form-urlencoded";

    call to method2 from client:

    HttpWebRequest myreq = (HttpWebRequest)WebRequest.Create("http://localhost:2054/my\_ws/MY\_WebService.asmx/Add");
    myreq.Method = "POST";
    myreq.ContentType = "application/x-www-form-urlencoded";

    server side for method2:

    \[WebMethod\]
    public int Add(int a, int b) {
        return (a + b);
    }
    
    S 1 Reply Last reply
    0
    • P priy

      Hi, I have created a webservice and on the client side i want to access it using Httprequest and httpresponse classes. There are two methods in that webservice.1 method returns a string.the 2nd method requires two integers as input parameters.how do i pass these parameters in the request from the client. call to Merthod1 from client:

      HttpWebRequest myreq = (HttpWebRequest)WebRequest.Create("http://localhost:2054/my\_ws/MY\_WebService.asmx/HelloWorld");
      myreq.Method = "POST";
      myreq.ContentType = "application/x-www-form-urlencoded";

      call to method2 from client:

      HttpWebRequest myreq = (HttpWebRequest)WebRequest.Create("http://localhost:2054/my\_ws/MY\_WebService.asmx/Add");
      myreq.Method = "POST";
      myreq.ContentType = "application/x-www-form-urlencoded";

      server side for method2:

      \[WebMethod\]
      public int Add(int a, int b) {
          return (a + b);
      }
      
      S Offline
      S Offline
      sunspeed
      wrote on last edited by
      #2

      What is the reason, that causes you to not insert a Web Reference to your Client Project?

      Der Staat mit der niedrigsten Geburtenrate ist nicht die Bundesrepublik, sondern der Vatikan.

      P 1 Reply Last reply
      0
      • S sunspeed

        What is the reason, that causes you to not insert a Web Reference to your Client Project?

        Der Staat mit der niedrigsten Geburtenrate ist nicht die Bundesrepublik, sondern der Vatikan.

        P Offline
        P Offline
        priy
        wrote on last edited by
        #3

        i want to implement a REST web service

        L 1 Reply Last reply
        0
        • P priy

          i want to implement a REST web service

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          A REST webservice and a MS web service is 2 different things. Look in writing you own IHttpHandler instead.

          xacc.ide - now with TabsToSpaces support
          IronScheme - 1.0 alpha 4a out now (29 May 2008)

          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