2 Replies - 2321 Views - Last Post: 20 August 2012 - 09:17 PM Rate Topic: -----

#1 sbonakalisos4  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 08-August 12

SENDING AN SMS

Posted 20 August 2012 - 03:49 PM

 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;
                }
            }


Is This A Good Question/Topic? 0
  • +

Replies To: SENDING AN SMS

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6081
  • View blog
  • Posts: 23,557
  • Joined: 23-August 08

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?
Was This Post Helpful? 0
  • +
  • -

#3 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 445
  • View blog
  • Posts: 1,501
  • Joined: 28-April 09

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1