.net - unable to send Byte[] from webform client project to web api service project using c#.working fine with webservice -


i have c# webform clientproject , web api service project.

i'm sending 1 file c# webform clientproject web api service project using byte[] @ web api service project i'm getting null byte[] same code working fine webservice code-is-here

winform c# project code

    private void button1_click(object sender, system.eventargs e)     {         filestream objfilestream = new filestream("c:\\mytext.dll",filemode.open,fileaccess.read);         int len = (int)objfilestream.length;         byte[] mybytearray = new byte[len];         objfilestream.read(mybytearray,0,len); // call service using rest sharp         var restclient = new restclient("http://localhost:51737/");             restsharp.restrequest restrequest = new restrequest("api/values", method.get);             restrequest.addparameter("docbinaryarray", mybytearray);             restrequest.addparameter("docname", sfile.remove(0, sfile.lastindexof("\\") + 1));              restrequest.addheader("header", "value");             restsharp.irestresponse restresponse = restclient.execute(restrequest);         objfilestream.close();     } 

now in web api service

// api/values         public ienumerable<string> get(byte[] docbinaryarray, string docname)         {             string strdocpath;             strdocpath = @"c:\users\servicetest\bin" + docname;             filestream objfilestream = new filestream(strdocpath, filemode.create, fileaccess.readwrite);             objfilestream.write(docbinaryarray, 0, docbinaryarray.length);             objfilestream.close();             return "";         } 

but inside web api service i'm getting null docbinaryarray why clue? i'm sending 1 dll file 1 solution solution using byte[] same code working fine web service.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -