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. how can i post parameters to a web page ?

how can i post parameters to a web page ?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpdatabasehelptutorial
5 Posts 3 Posters 1 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

    hello all : i wanted send some information to a form that is on the web (http://www.cao.ir/farsi/fids/index.asp), with C# languge i wanted to generate a code on c# that fill this form automatically & give me information after fill & post that but i don't know how can i do it !! i can tell you that i wanted to produced a spider or robot to do it. please guide & help me to find it out hope To hear from u soon Kind Regards

    A G B 4 Replies Last reply
    0
    • B B A

      hello all : i wanted send some information to a form that is on the web (http://www.cao.ir/farsi/fids/index.asp), with C# languge i wanted to generate a code on c# that fill this form automatically & give me information after fill & post that but i don't know how can i do it !! i can tell you that i wanted to produced a spider or robot to do it. please guide & help me to find it out hope To hear from u soon Kind Regards

      A Offline
      A Offline
      Amit Kumar Chikara
      wrote on last edited by
      #2

      You will have to write a class for HTTP Upload. Which can upload data on the given HTTP locaion.

      Regards, Amit Kumar HDISM, PGDCA, MCP, MCAD, MCSD amit_chikara2002@hotmail.com

      1 Reply Last reply
      0
      • B B A

        hello all : i wanted send some information to a form that is on the web (http://www.cao.ir/farsi/fids/index.asp), with C# languge i wanted to generate a code on c# that fill this form automatically & give me information after fill & post that but i don't know how can i do it !! i can tell you that i wanted to produced a spider or robot to do it. please guide & help me to find it out hope To hear from u soon Kind Regards

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Please don't cross post.

        --- b { font-weight: normal; }

        1 Reply Last reply
        0
        • B B A

          hello all : i wanted send some information to a form that is on the web (http://www.cao.ir/farsi/fids/index.asp), with C# languge i wanted to generate a code on c# that fill this form automatically & give me information after fill & post that but i don't know how can i do it !! i can tell you that i wanted to produced a spider or robot to do it. please guide & help me to find it out hope To hear from u soon Kind Regards

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

          hello again ... and thank you ok ,i find how declare parameter and post to server ... i find it from this site : http://en.csharp-online.net/index.php?title=HTTP\_Post and here the solve : using System.Net; ... string HttpPost (string uri, string parameters) { // parameters: name1=value1&name2=value2 WebRequest webRequest = WebRequest.Create (uri); //string ProxyString = System.Configuration.ConfigurationManager.AppSettings // [GetConfigKey("proxy")]; //webRequest.Proxy = new WebProxy (ProxyString, true); //Commenting out above required change to App.Config webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.Method = "POST"; byte[] bytes = Encoding.ASCII.GetBytes (parameters); Stream os = null; try { // send the Post webRequest.ContentLength = bytes.Length; //Count bytes to send os = webRequest.GetRequestStream(); os.Write (bytes, 0, bytes.Length); //Send it } catch (WebException ex) { MessageBox.Show ( ex.Message, "HttpPost: Request error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } finally { if (os != null) { os.Close(); } } try { // get the response WebResponse webResponse = webRequest.GetResponse(); if (webResponse == null) { return null; } StreamReader sr = new StreamReader (webResponse.GetResponseStream()); return sr.ReadToEnd ().Trim (); } catch (WebException ex) { MessageBox.Show ( ex.Message, "HttpPost: Response error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } return null; } // end HttpPost

          1 Reply Last reply
          0
          • B B A

            hello all : i wanted send some information to a form that is on the web (http://www.cao.ir/farsi/fids/index.asp), with C# languge i wanted to generate a code on c# that fill this form automatically & give me information after fill & post that but i don't know how can i do it !! i can tell you that i wanted to produced a spider or robot to do it. please guide & help me to find it out hope To hear from u soon Kind Regards

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

            hello using System.Net; ... string HttpPost (string uri, string parameters) { // parameters: name1=value1&name2=value2 WebRequest webRequest = WebRequest.Create (uri); //string ProxyString = System.Configuration.ConfigurationManager.AppSettings // [GetConfigKey("proxy")]; //webRequest.Proxy = new WebProxy (ProxyString, true); //Commenting out above required change to App.Config webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.Method = "POST"; byte[] bytes = Encoding.ASCII.GetBytes (parameters); Stream os = null; try { // send the Post webRequest.ContentLength = bytes.Length; //Count bytes to send os = webRequest.GetRequestStream(); os.Write (bytes, 0, bytes.Length); //Send it } catch (WebException ex) { MessageBox.Show ( ex.Message, "HttpPost: Request error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } finally { if (os != null) { os.Close(); } } try { // get the response WebResponse webResponse = webRequest.GetResponse(); if (webResponse == null) { return null; } StreamReader sr = new StreamReader (webResponse.GetResponseStream()); return sr.ReadToEnd ().Trim (); } catch (WebException ex) { MessageBox.Show ( ex.Message, "HttpPost: Response error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } return null; } // end HttpPost

            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