public string readHtmlPage(string url)
{
WebResponse objResponse = default(WebResponse);
WebRequest objRequest = default(WebRequest);
string result = null;
try
{
objRequest = System.Net.HttpWebRequest.Create(url);
objResponse = objRequest.GetResponse();
StreamReader sr = new StreamReader(objResponse.GetResponseStream());
result = sr.ReadToEnd();
//clean up StreamReader
sr.Close();
return result;
}
catch (Exception ex)
{
string s = ex.ToString();
if (Convert.ToBoolean( Microsoft.VisualBasic.Strings.InStr(s,"(404)"))) --This is where i get the error.
{
return "URL: " + url + " not found.";
}
else
{
return s;
}
}
SENDING AN SMS
Page 1 of 12 Replies - 851 Views - Last Post: 20 August 2012 - 09:17 PM
#1
SENDING AN SMS
Posted 20 August 2012 - 03:49 PM
Replies To: SENDING AN SMS
#2
Re: SENDING AN SMS
Posted 20 August 2012 - 03:54 PM
Quote
if (Convert.ToBoolean( Microsoft.VisualBasic.Strings.InStr(s,"(404)"))) --This is where i get the error.
WHAT ERROR???? Why the heck are you using VisualBasic code in C# ANYWAY?
#3
Re: SENDING AN SMS
Posted 20 August 2012 - 09:17 PM
yeah, there's very few cases where you'd need to use a call to visual basic inside C#, and this is definitely not one of them from what I can see. You should just be able to use string.Contains if you're wanting to check if the message contains some specific text.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|