A: 

"As result it returns initial upload page, not a result page with links i could parse and present to a user..."

Maybe that's just the behaviour of the upload functionality: that after the upload has finished, you can upload another file? I think you have to call another url for the "browse for file"-page (I suppose that's the one you need).


Edit: Actually, if the server sends a "redirect" (http 3xx), that's something the browser has to handle, so if you're working with your own client application in stead of a browser, you'll have to implement redirection yourself. Here the rfc for more information.

fretje
The truth is somewhere out there... The common usage scenario of a service step by step is as follows:1) loading service front page somehost.com (actually somehost.com/index.php) ;2) Choosing file to upload via browse and file open dialog ;3) Checking "agree to Terms of Service" checkbox to enable upload button (in non-browser case it doesn't affect anything i guess?)4) Hit "Upload!"5) Wait for file to upload on the same location (just some js progressbar displayed over the form, /ignore)6) See and copy links to file and "delete file" action. Address is somehost.com/upload.php?do=verify.
Jaded
The point is to get contents of a page with links, single nor multiply file download is useless if we can't find them after upload. Calling "correct" page has logic, but "upload.php?do=verify" page is generated only after request finish and manual navigation to it gives us an error "no file chosen".
Jaded
+1  A: 

Update : nope, there is no redirect.

screenshot

Read RFC2388 few times, rewrote the code and it finally worked (i guess the trouble was in utf-read trailing boundary instead of correct 7 bit ascii). Hooray? Nope :(. Only small files are transfered, big ones throwing "The connection was closed unexpectedly".

System.Net.WebException was unhandled by user code
  Message="The underlying connection was closed: The connection was closed unexpectedly."
  Source="Uploader"
  StackTrace:
   at Uploader.Upload.ProcessUpload(String FilePath, String description, String password) in F:\MyDocuments\Visual Studio 2008\Projects\Uploader\Uploader.cs:line 96
   at Uploader.Form1.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e) in F:\MyDocuments\Visual Studio 2008\Projects\Uploader\Form1.cs:line 45
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

I know that's a bug with .net stack and few solutions exists :

1) increase both Timeout and ReadWriteTimeout of request

2) assign request.KeepAlive = false and System.Net.ServicePointManager.Expect100Continue = false

3) set ProtocolVersion to 1.0 But neither one of them nor all of them altogether help in my case. Any ideas?

EDIT - Source code:

// .. request created, required params applied
httpWebRequest.ProtocolVersion = HttpVersion.Version10; // fix 1
httpWebRequest.KeepAlive = false; // fix 2
httpWebRequest.Timeout = 1000000000; // fix 3
httpWebRequest.ReadWriteTimeout = 1000000000; // fix 4
// .. request processed, data written to request stream
string strResponse = "";            
try
{
    using (WebResponse httpResponse = httpWebRequest.GetResponse()) // error here
        {
            using (Stream responseStream = httpResponse.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(responseStream))
                    {
                        strResponse = streamReader.ReadToEnd();
                    }
                }
            }
        }
catch (WebException exception)
{
    throw exception;
}
Jaded
On some hosts code is working, on some not... I think i can leave the above as is. The only interesting point i have - how to implement the upload progress.
Jaded
A: 

Try setting the maxRequestLength property of the httpRuntime element in the Web.config.

fredmerlo