ASPX receives the information that the Windows application sends out in the form of a file

Source: Internet
Author: User
Tags httpcontext variables
window| Program

I've finally come out of this fool. Don't ask me what I pulled out, it's all written in the title ....
Write it down, and then sleep ....

Now have tried asp,js,c++,c#, the first three are months or even years of experience, to try to make the last one too big ....

What's next?

Cut to the chase ...

Windows-Side applications

1, first set up two post variables, and these two post variables simulate the name~~~ of the form in ASP (I tried to be a mock form)


System.Net.WebClient webclientobj=new System.Net.WebClient ();
System.Collections.Specialized.NameValueCollection postvars=new System.Collections.Specialized.NameValueCollection ();
Postvars.add ("C", TextBox2.Text);
Postvars.add ("B", TextBox3.Text);
TextBox2.Text, there's a message for post, huh?

2, and then sent to a Web page: http://www.dc9.cn/t/default.aspx

Try
{
Byte[] Byremoteinfo=webclientobj.uploadvalues ("http://www.dc9.cn/t/default.aspx", "POST", postvars);
It's useless down there, just a word on it.
String sremoteinfo=system.text.encoding.default.getstring (Byremoteinfo);
This is the Get return information
Textbox1.text=sremoteinfo;
Axdhtmledit1.documenthtml=sremoteinfo;
The following uses the COM component WebBrowser, lets him display returns the information, is useless, may not look.
Object Url= "About:blank";
Object Nothing=system.reflection.missing.value;
This.axWebBrowser1.Navigate2 (ref url,ref Nothing,ref nothing,ref nothing,ref Nothing);
(MSHTML. IHTMLDocument2) this.axWebBrowser1.Document). Write (Sremoteinfo);
}
Catch
{}


Web-side applications

1, written in Page_Load.

String mytext=system.web.httpcontext.current.request.form["C"];
String mytext2=system.web.httpcontext.current.request.form["B"];
Get two Post information
StreamWriter Sw=new StreamWriter (Server.MapPath (".") + "\\1.shtml", true, Encoding.UTF8);
Sw. Write (MyText);
Sw. Write (MYTEXT2);
Sw. Close ();
True means that the post information is written in a append manner


Well, it's written here.

Do not know how to write files in this way is more efficient than FSO and adodb.stream CPU small, but also hope that the expert guidance!



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.