Note that there are some explanatory texts on larger screens.

plurals
  1. POWebRequest.Create problem
    primarykey
    data
    text
    <p>My requirement is downlaoding a HTTM page. Like and I am using WebRequest.Create. But the line </p> <pre><code>HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://www.mayosoftware.com"); </code></pre> <p>Is throwing an exception {"Configuration system failed to initialize"}. I am working in a compmany. Does it due to proxy or anything? But it’s occurring while creation of the URL it self.</p> <pre><code>Exception trace is: at System.Configuration.ConfigurationManager.PrepareConfigSystem() at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) at System.Net.Configuration.WebRequestModulesSectionInternal.GetSection() at System.Net.WebRequest.get_PrefixList() at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase) </code></pre> <p>Code is like </p> <pre><code>void GetHTTPReq() { Looking forward on it. The complete code is as follows but problem is in the starting itself : \\ // used to build entire input StringBuilder sb = new StringBuilder(); // used on each read operation byte[] buf = new byte[8192]; // prepare the web page we will be asking for HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://www.mayosoftware.com"); // execute the request HttpWebResponse response = (HttpWebResponse) request.GetResponse(); // we will read data via the response stream Stream resStream = response.GetResponseStream(); string tempString = null; int count = 0; do { // fill the buffer with data count = resStream.Read(buf, 0, buf.Length); // make sure we read some data if (count != 0) { // translate from bytes to ASCII text tempString = Encoding.ASCII.GetString(buf, 0, count); // continue building the string sb.Append(tempString); } } while (count &gt; 0); // any more data to read? // print out page source Console.WriteLine(sb.ToString()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload