Click here to Skip to main content
15,890,185 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem with quicktime component (System.AccessViolationException) Pin
combo_ci15-Jun-07 23:25
combo_ci15-Jun-07 23:25 
QuestionTimeSpan Pin
Ian Uy15-Jun-07 19:13
Ian Uy15-Jun-07 19:13 
AnswerRe: TimeSpan Pin
Ravi Bhavnani15-Jun-07 19:26
professionalRavi Bhavnani15-Jun-07 19:26 
AnswerRe: TimeSpan Pin
PIEBALDconsult15-Jun-07 19:36
mvePIEBALDconsult15-Jun-07 19:36 
GeneralRe: TimeSpan Pin
Ian Uy15-Jun-07 19:42
Ian Uy15-Jun-07 19:42 
GeneralRe: TimeSpan Pin
Luc Pattyn15-Jun-07 21:02
sitebuilderLuc Pattyn15-Jun-07 21:02 
QuestionA question about Add-in Pin
imagic15-Jun-07 18:57
imagic15-Jun-07 18:57 
QuestionStreamReader problem Pin
gvanto15-Jun-07 17:26
gvanto15-Jun-07 17:26 
I have a problem when reading a Streamreader object into a string:

<br />
private string GetStringFromURL(string url)<br />
        {<br />
            string strOut = "";<br />
<br />
            // Attempt download from internet:<br />
            HttpWebRequest webRequest;<br />
            HttpWebResponse webResponse;<br />
            Stream responseStream;<br />
            //try<br />
            //{<br />
            webRequest = (HttpWebRequest)WebRequest.Create(url); //creating a web request object<br />
            webResponse = (HttpWebResponse)webRequest.GetResponse(); // creat a webResponse object so we can get the responces from server when we hs used the web request <br />
            responseStream = webResponse.GetResponseStream(); // creating a response stream object for the webResponse we have just created so we can use to get info into a StreamReader later<br />
            string responseEncoding = webResponse.ContentEncoding.Trim();<br />
            if (responseEncoding.Length == 0) responseEncoding = "us-ascii";<br />
            //loading the html page into a streamReader <br />
            StreamReader sr = new StreamReader(responseStream, System.Text.Encoding.GetEncoding(responseEncoding));<br />
<br />
            sr.BaseStream.ReadTimeout = 3000;  // 3 seconds<br />
            try<br />
            {<br />
                strOut = sr.ReadToEnd();<br />
            }<br />
            catch (WebException ioe)<br />
            {<br />
                MessageBox.Show(ioe.Message.ToString());<br />
            }<br />
<br />
<br />
            //while ((line = sr.ReadLine()) != null)<br />
            //{<br />
            //    strOut += line;<br />
            //}<br />
            webResponse.Close();<br />
            responseStream.Close();<br />
            sr.Close();<br />
            //}<br />
            //catch(WebException e)<br />
            //{<br />
            //    MessageBox.Show(e.Message);<br />
            //    // do nothing<br />
<br />
            //}<br />
<br />
            return strOut;<br />
<br />
            //string filePath = Application.StartupPath.ToString() + @"\" + "fileProxyRead.txt";<br />
            //return GetStringFromFile(filePath);<br />
        }<br />
<br />


The above code doesn't cause the Messagebox to actually pop up. When I pause the code I find it spends alot of it's time in the catch() area though. On closer inspection of the 'sr' object, it seems to have a problem:
<br />
BaseStream = Cannot evaluate expression because a native frame is on top of the call stack.<br />


Is there a way of checking for this error with an 'if' statement so that this process doesn't take so long? (it does eventually time out but this is v. slow. The url I'm reading into the string is:
http://www.atomintersoft.com/products/alive-proxy/proxy-list/?p=4[^]

Any help or advice much appreciated!!
Gerry



Put A Smile On Your Face
http://www.thecrazywebsite.com

AnswerRe: StreamReader problem Pin
Guffa16-Jun-07 0:00
Guffa16-Jun-07 0:00 
QuestionListView Focus Pin
Ian Uy15-Jun-07 16:49
Ian Uy15-Jun-07 16:49 
AnswerRe: ListView Focus Pin
Ravi Bhavnani15-Jun-07 18:10
professionalRavi Bhavnani15-Jun-07 18:10 
GeneralRe: ListView Focus Pin
Ian Uy15-Jun-07 18:19
Ian Uy15-Jun-07 18:19 
Questionunpack dll Pin
topksharma198215-Jun-07 13:53
topksharma198215-Jun-07 13:53 
AnswerRe: unpack dll Pin
Luc Pattyn15-Jun-07 14:57
sitebuilderLuc Pattyn15-Jun-07 14:57 
GeneralRe: unpack dll Pin
topksharma198215-Jun-07 22:31
topksharma198215-Jun-07 22:31 
GeneralRe: unpack dll Pin
pkfox18-Jun-07 0:16
professionalpkfox18-Jun-07 0:16 
AnswerRe: unpack dll Pin
pkfox18-Jun-07 0:17
professionalpkfox18-Jun-07 0:17 
Questionprogressbar invoke Pin
Scalee15-Jun-07 13:12
Scalee15-Jun-07 13:12 
AnswerRe: progressbar invoke Pin
Luc Pattyn15-Jun-07 13:22
sitebuilderLuc Pattyn15-Jun-07 13:22 
Questionsnippets Pin
tarun suneja15-Jun-07 12:51
tarun suneja15-Jun-07 12:51 
AnswerRe: snippets Pin
Luc Pattyn15-Jun-07 13:05
sitebuilderLuc Pattyn15-Jun-07 13:05 
QuestionDown-Casting Pin
Madmaximus15-Jun-07 12:12
Madmaximus15-Jun-07 12:12 
AnswerRe: Down-Casting Pin
Luc Pattyn15-Jun-07 12:19
sitebuilderLuc Pattyn15-Jun-07 12:19 
Questionevent form Pin
SVb.net15-Jun-07 11:55
SVb.net15-Jun-07 11:55 
AnswerRe: event form Pin
Luc Pattyn15-Jun-07 12:22
sitebuilderLuc Pattyn15-Jun-07 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.