Trying Cadavre's script I get the following error:
A WebException has been caught.System.UriFormatException: Invalid URI: The URI scheme is not valid.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at ST_34df453e99e647559a2fcbd13a9d9831.vbproj.ScriptMain.Main()
It could be what I'm reading into the variables, but the URL is valid and the authorization should be valid too.
Looking at David's script, I'm wondering... Is the length of a regular text file the same in bytes as the length of a MIME encoded file?