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. I have an aspx app which needs to post data to a form and read the response.

I have an aspx app which needs to post data to a form and read the response.

Scheduled Pinned Locked Moved ASP.NET
helpquestion
8 Posts 4 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.
  • B Offline
    B Offline
    B A
    wrote on last edited by
    #1

    Hi, I have an aspx app which needs to post data to a form and read the response. i try to use "webClient" and "HttpWebRequest" classes, but can not get response ? can you help me and get a refrence? please:((

    M B P 3 Replies Last reply
    0
    • B B A

      Hi, I have an aspx app which needs to post data to a form and read the response. i try to use "webClient" and "HttpWebRequest" classes, but can not get response ? can you help me and get a refrence? please:((

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      function xmlhttpPost(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring()); } function getquerystring() { var form = document.forms['f1']; var word = form.word.value; qstr = 'w=' + escape(word); // NOTE: no '?' before querystring return qstr; } ------------------------------------------------------ This is for posting.... self.xmlHttpReq.send(getquerystring()); This is for getting the response.... self.xmlHttpReq.responseText

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      B 1 Reply Last reply
      0
      • M Michael Sync

        function xmlhttpPost(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring()); } function getquerystring() { var form = document.forms['f1']; var word = form.word.value; qstr = 'w=' + escape(word); // NOTE: no '?' before querystring return qstr; } ------------------------------------------------------ This is for posting.... self.xmlHttpReq.send(getquerystring()); This is for getting the response.... self.xmlHttpReq.responseText

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

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

        hi : Michael Sync tank you .:rose: your answer is with javaScript. can you get me an example with C# or VB.NET ?

        M 1 Reply Last reply
        0
        • B B A

          Hi, I have an aspx app which needs to post data to a form and read the response. i try to use "webClient" and "HttpWebRequest" classes, but can not get response ? can you help me and get a refrence? please:((

          B Offline
          B Offline
          Bassam Saoud
          wrote on last edited by
          #4

          you want to post data from an ASP.NET application to a form in another ASP.NET application ? Anyways to post data from a web form to another you can Add PostBackUrl="<YOUR_FORM_Path>" property to the submit button or use Server.Transfer and set the preserveForm parameter to True (for example Server.Transfer("<YOUR_FORM_Path>", True) ) Now to read post data you can use Request.Forms("") to access value for a specific control Hope this helps.

          B 1 Reply Last reply
          0
          • B B A

            hi : Michael Sync tank you .:rose: your answer is with javaScript. can you get me an example with C# or VB.NET ?

            M Offline
            M Offline
            Michael Sync
            wrote on last edited by
            #5

            Have you read Bassam Saoud's post?? maybe.. this is what you want..

            Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

            1 Reply Last reply
            0
            • B B A

              Hi, I have an aspx app which needs to post data to a form and read the response. i try to use "webClient" and "HttpWebRequest" classes, but can not get response ? can you help me and get a refrence? please:((

              P Offline
              P Offline
              Prateek G
              wrote on last edited by
              #6

              HttpWebRequest hReq = (HttpWebRequest)HttpWebRequest.Create(ReqUrl); HttpWebResponse hResp = (HttpWebResponse)hReq.GetResponse(); Stream str = hResp.GetResponseStream(); Can you be more specific about your problem??????

              B 1 Reply Last reply
              0
              • B Bassam Saoud

                you want to post data from an ASP.NET application to a form in another ASP.NET application ? Anyways to post data from a web form to another you can Add PostBackUrl="<YOUR_FORM_Path>" property to the submit button or use Server.Transfer and set the preserveForm parameter to True (for example Server.Transfer("<YOUR_FORM_Path>", True) ) Now to read post data you can use Request.Forms("") to access value for a specific control Hope this helps.

                B Offline
                B Offline
                B A
                wrote on last edited by
                #7

                tanks Bassam

                1 Reply Last reply
                0
                • P Prateek G

                  HttpWebRequest hReq = (HttpWebRequest)HttpWebRequest.Create(ReqUrl); HttpWebResponse hResp = (HttpWebResponse)hReq.GetResponse(); Stream str = hResp.GetResponseStream(); Can you be more specific about your problem??????

                  B Offline
                  B Offline
                  B A
                  wrote on last edited by
                  #8

                  tank you

                  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