Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:14:20+00:00 2026-06-14T05:14:20+00:00

three questions please 1) If there is an exception in the try below will

  • 0

three questions please

1) If there is an exception in the try below will the request stream automatically close as it is in a using

2)do I even need the requestStream.Close() and requestStream.Dispose() as it is in a using?

3) do I need to close the System.Net.FtpWebRequest?

Try


    Dim rqst As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://1.com/text.txt"), System.Net.FtpWebRequest)
    rqst.Credentials = New System.Net.NetworkCredential("useb", "pass")
    rqst.Method = System.Net.WebRequestMethods.Ftp.UploadFile

    'Throw New ApplicationException("Exception Occured")
    Dim fle() As Byte = System.IO.File.ReadAllBytes("C:\test.txt")

    Using requestStream As Stream = rqst.GetRequestStream()


        requestStream.Write(fle, 0, fle.Length)
        requestStream.Close() 'do I need this?
        requestStream.Dispose() 'do I need this ?

    End Using

Catch ex As Exception

    MessageBox.Show(ex.Message.ToString())

End Try
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:14:21+00:00Added an answer on June 14, 2026 at 5:14 am

    No you dont need if you are using using. As using itself is used to dispose of. Also the reason for the “using” statement is to ensure that the object is always disposed correctly, and it doesn’t require explicit code to ensure that this happens.

    Dispose method is called immediately when control flow exits the using block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is actually a three-part question, which I'll explain below, but the questions are:
Please bare if is repeated question... In my application there is a pdf file
Before jumping on me, please read my question carefully :D. I know there are
if($err) $_SESSION['msg']['login-err'] = implode('<br />',$err); Three quick questions: Why use a two-dimensional array here?
Three SHA512Managed related questions: Is SHA512Managed considered the best one-way hash available in .NET
There are questions pertaining to reading settings from a separate config file and others
I know there are questions similar to this one, but I've not found a
Ok, there are questions about Why Is MongoDB So Fast I appreciate those answers,
In my application I need to display questions along with images in Android. I
Please take a look at my simple three-methods Service class that streams audio and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.