Read the network file and get the Escape Character (for example, get the XML file of the Network)

Source: Internet
Author: User

Public String runregisternoparam (string strregisterurl, string PARAM)
{
String strren = "";
Try
{
Cookiecontainer Container = new cookiecontainer ();
Httpwebrequest request = (httpwebrequest) webrequest. Create (strregisterurl + "? "+ PARAM );
Request. cookiecontainer = container;
Request. contenttype = "application/X-WWW-form-urlencoded ";
Request. method = "Post ";
Stream myrequeststream = request. getrequeststream ();
Streamwriter mystreamwriter = new streamwriter (myrequeststream, encoding. getencoding ("UTF-8 "));
Mystreamwriter. Write (PARAM );
// Write data to the request stream of httpwebrequest
Mystreamwriter. Close ();
Myrequeststream. Close ();
// Close the open object
Httpwebresponse myhttpwebresponse = (httpwebresponse) request. getresponse ();
// Create an httpwebresponse
Myhttpwebresponse. Cookies = container. getcookies (request. requesturi );
// Obtain the cookiecollection of a cookie set containing a URL
Stream myresponsestream = myhttpwebresponse. getresponsestream ();
Streamreader mystreamreader = new streamreader (myresponsestream, encoding. getencoding ("UTF-8 "));
Strren = mystreamreader. readtoend ();
// Read the data from the response stream of httpwebresponse
Mystreamreader. Close ();
Myresponsestream. Close ();
}
Catch (exception ex)
{
Throw ex;
}
Return strren;
}

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.