Ashwin Chauhan

Ashwin Chauhan

  • 1.2k
  • 548
  • 84.2k

how to send multipart/form-data in web services?

Nov 9 2018 11:29 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using System.Web.Services;
using Newtonsoft.Json;
using System.Net;
namespace WebServiceDemo.Api
{
/// <summary>
/// Summary description for Api
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Api : System.Web.Services.WebService
{
[System.Web.Services.WebMethod(EnableSession=true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string Login(string glcode,string password)
{
var objList = new CommanListView<String>();
var lsi = new List<string>();
lsi.Add(glcode);
lsi.Add(password);
objList.Entiry = lsi;
return CommanAttribut.GetJsonSerlizer(objList);
}
}
}
error 
System.InvalidOperationException: Request format is invalid: multipart/form-data; boundary=----WebKitFormBoundary79Ky1A1Kfyyy7qUi.
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
that error have getting by postman.
 
 
 

Answers (1)