How do I test if requestStream is closed and disposed if the exception occurs
Try
Using requestStream As Stream = rqst.GetRequestStream()
requestStream.Write(fle, 0, fle.Length)
Throw New ApplicationException("Exception Occured")
End Using
Catch ex As Exception
MessageBox.Show(ex.Message.ToString())
Finally
'test if the requeststream is closed and disposed?
MessageBox.Show("")
End Try
That’s what
Usingdoes. Even if there’s an exception,usingcauses the compiler to bake in afinallyclause that will callDispose.No need to do it again.