- public static string DoWebreqeust(string url, string json)
- {
- try
- {
- HttpWebRequest request = (HttpWebRequest)
- WebRequest.Create(url); request.KeepAlive = false;
- request.ProtocolVersion = HttpVersion.Version10;
- request.Method = "POST";
- byte[] postBytes = Encoding.UTF8.GetBytes(json);
- request.ContentType = "application/json; charset=UTF-8";
- request.Accept = "application/json";
- // request.ContentType = "application/x-www-form-urlencoded";
- request.ContentLength = postBytes.Length;
- Stream requestStream = request.GetRequestStream();//error line
- requestStream.Write(postBytes, 0, postBytes.Length);
- requestStream.Close();
- HttpWebResponse response = (HttpWebResponse)request.GetResponse();
- string result;
- using (StreamReader rdr = new StreamReader(response.GetResponseStream()))
- {
- result = rdr.ReadToEnd();
- }
- return result;
- }
- catch (Exception ex)
- {
- return "";
- }
- }
mvc with webapi
above code
i send a 3 pdf files with base64 data to api
'responseStream.Length' threw an exception of type 'System.NotSupportedException'.
Length = 'dataStream.Length' threw an exception of type 'System.NotSupportedException'
Position = 'dataStream.Position' threw an exception of type 'System.NotSupportedException'
Mageshwaran RPosted Nov 22, 2019, 12:44 PM
Gajendra JangidPosted Jun 12, 2019, 8:11 AM
Laxman DussaPosted Jun 12, 2019, 6:36 AM
Jaish MathewsPosted Jun 12, 2019, 4:12 AM
Rajeesh MenothPosted Jun 12, 2019, 1:24 AM