Programming

Categories

  • No categories

SEARCH


Testing out Code Formatting

Posted in: Programming by Steve on February 29, 2008

Thanks to RossCode for recommending this plugin for Windows Live Writer, “Insert Code for WLW

Too bad I don’t have a wider blog theme, but I really like this one.  Testing out the VB functionality since I don’t really see VB examples that often:

 
   1:          ''' <summary>
   2:          ''' This method checks to see if the given URL is available and accepting requests.
   3:          ''' </summary>
   4:          ''' <param name="url"></param>
   5:          ''' <returns></returns>
   6:          ''' <remarks></remarks>
   7:          Public Function IsUrlAvailable(ByVal url As String) As Boolean
   8:              Try
   9:                  Dim req As HttpWebRequest = WebRequest.Create(url)
  10:                  Dim rsp As HttpWebResponse = req.GetResponse()
  11:                  If rsp.StatusCode = HttpStatusCode.OK Then
  12:                      Return True
  13:                  End If
  14:              Catch ex As WebException
  15:                  ' Eat it because all we want to do is return false
  16:              End Try
  17:              Return False
  18:          End Function