inet component

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yusuf

    #1

    inet component

    ý m using visual basic.net but inet(internet transfer control) comp. don't
    have in my dot.net
    ý have to inet comp. because I must send data a web pages with post method..
    and. I don' t have webbrowser in my dot.net. where can I find?

    and

    how is send data a web pages with post method..


  • Dino Chiesa [Microsoft]

    #2
    Re: inet component

    If what you want to do is programmaticall y post to a web page, then
    System.Net.WebR equest will do it.

    This is not VB.NET, but you get the idea:

    private static string PostURI(string URI, string Parameters)
    {
    string CommandURI = URI;
    WebRequest myWebRequest = WebRequest.Crea te(CommandURI);

    //needed only if outbound traffic must go through a proxy server
    //WebProxy proxyObject = new WebProxy("http://proxyserver:80/",true);
    //myWebRequest.Pr oxy = proxyObject;

    myWebRequest.Co ntentType = "applicatio n/x-www-form-urlencoded";
    myWebRequest.Me thod = "POST";
    byte [] bytes = System.Text.Enc oding.ASCII.Get Bytes(Parameter s);
    myWebRequest.Co ntentLength = bytes.Length;
    Stream OutputStream = myWebRequest.Ge tRequestStream ();
    OutputStream.Wr ite (bytes, 0, bytes.Length);
    OutputStream.Cl ose ();
    WebResponse MyWebResponse = myWebRequest.Ge tResponse();
    Stream MyStream = MyWebResponse.G etResponseStrea m();
    StreamReader MyStreamReader = new StreamReader(My Stream);
    return MyStreamReader. ReadToEnd().Tri m();
    }


    usage:

    String sPostData= "Argument1= " + sData + "&Argument2=Som ethingElse";
    String sResultHtml= PostURI("http://server/something/something",
    sPostData);



    "Yusuf" <admin@xboxdeli si.com> wrote in message
    news:%23UHw4jcv DHA.3532@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    > ý m using visual basic.net but inet(internet transfer control) comp. don't
    > have in my dot.net
    > ý have to inet comp. because I must send data a web pages with post[/color]
    method..[color=blue]
    > and. I don' t have webbrowser in my dot.net. where can I find?
    >
    > and
    >
    > how is send data a web pages with post method..
    >
    >[/color]


    Comment

    Working...