asp.net mvc - Send large string from Android to MVC -


i'm trying send large string android mvc application , android. below codes mvc application.

[httppost]     public httpresponsemessage retrievestring(string longstring)     {         var resp = new httpresponsemessage()         {             content = new stringcontent("{\"resultstring\":\"" + longstring + "\"}")         };         resp.content.headers.contenttype = new mediatypeheadervalue("application/json");         return resp;     } 

here code android application

protected string doinbackground(string... params) {          httpurlconnection urlconnection = null;         bufferedreader reader = null;         string jsonstr = null;          try {             final string url = "http://172.27.179.197:7837/api/testcon/retrievestring?";              uri builturi = uri.parse(url).buildupon()                     .appendqueryparameter("longstring", params[0]).build();              url url = new url(builturi.tostring());              urlconnection = (httpurlconnection) url.openconnection();             urlconnection.setrequestmethod("post");             urlconnection.setrequestproperty("connection", "keep-alive");             urlconnection.setrequestproperty("content-type", "multipart/form-data");             urlconnection.connect();              inputstream inputstream = urlconnection.getinputstream();             stringbuffer buffer = new stringbuffer();             if (inputstream == null) {                 return null;             }             reader = new bufferedreader(new inputstreamreader(inputstream));              string line;             while ((line = reader.readline()) != null) {                 buffer.append(line + "\n");             }              if (buffer.length() == 0) {                 return null;             }             jsonstr = buffer.tostring();         } catch (ioexception e) {             log.e(log_tag, "error ", e);             return null;         } {             if (urlconnection != null) {                 urlconnection.disconnect();             }             if (reader != null) {                 try {                     reader.close();                 } catch (final ioexception e) {                     log.e(log_tag, "error closing stream", e);                 }             }         }         return jsonstr;     } 

this codes work fine i'm sending in short string. however, when string long (hundreds or thousands of characters), android application throws "java.io.filenotfoundexception: http://172.27.179.197:7837/api/testcon/retrieveuserbyemail?inputemail=<<very long string>>" exception. advice on how send long string across mvc? thanks!


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -