c# - Webclient produce boundary ----WebKitFormBoundary8huFCK1rAfUxxul6 -


i have webclient , trying upload file programmatically in c#.

while uploading file using real webform following problem:

------webkitformboundary8hufck1rafuxxul6 content-disposition: form-data; name="__eventtarget"   ------webkitformboundary8hufck1rafuxxul6 content-disposition: form-data; name="__eventargument"   ------webkitformboundary8hufck1rafuxxul6 content-disposition: form-data; name="__viewstate" 

the code using upload file follows:

internal void uploadfile(system.io.fileinfo cvfileinfo)     {         if (cvfileinfo.exists == false)             throw new filenotfoundexception("the specified file not found.");  //i know part wrong >         var values = new namevaluecollection         {             { "content-disposition: form-data; name=\"__eventtarget\""        , ""                  } ,             { "content-disposition: form-data; name=\"__eventargument\""      , ""                  } ,             { "content-disposition: form-data; name=\"__viewstate\""          , _viewstate          } ,             { "content-disposition: form-data; name=\"__viewstate\""          , _viewstategenerator } ,             { "content-disposition: form-data; name=\"__eventvalidation\""    , _eventvalidation    } ,             { "content-disposition: form-data; name=\"ctl00$main$cvfile\"; filename=\"kiran randhawa - curriculum vitae - copy.docx\" content-type: application/octet-stream", encoding.utf8.getstring(file.readallbytes(cvfileinfo.fullname)) },             { "content-disposition: form-data; name=\"ctl00$main$btnupload\"" , "upload now"         } ,         };          var returnedbytes = client.uploadvalues(_uploadcvurl, values);         var returnedstring = system.text.encoding.utf8.getstring(returnedbytes);          if (returnedstring != null)         {          }     } 

how fix in such way produces desired packet output.

many thanks, kiran


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -