Possible Duplicate:
Response.Redirect(“”) inside “using{ }”
Pretty much that. If I had, for example, a connection to the database in a using statement and somewhere inside that using statement I redirected to another page, would it dispose of my connection or would I have to manually call it first?
Yes, it would absolutely call
Dispose. The point of ausingstatement is thatDisposeis called in afinallyblock, so the resource will be disposed whether the block completes normally or with an exception.There’s a slight wrinkle here in that IIRC,
Response.Redirectthrows aThreadAbortExceptionwhich will automatically rethrow if it’s caught, but that shouldn’t affect afinallyblock.