the following error message occus when i run my code
control can not leave the body of a finally clause
code is below
private static string GetWebText(string url)
{
try
{
HttpWebRequest request = (HttpWebRequest)HttpWebReq
uest.Creat
e(url);
request.UserAgent = "A .NET Web Crawler";
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream
();
StreamReader reader = new StreamReader(stream);
string htmlText = reader.ReadToEnd();
return htmlText;
// throw new Exception();
}
finally
{
return htmltext;
}
}
Start Free Trial