TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sourav Kumar Das
527
2.5k
171.7k
How to use Multipart/formdata in Web API?
Jan 13 2020 3:37 AM
Hi All,
I have a doubt in the below code that I have tried the multi part/ form data in Web Config and Global.asax files and passed through controller but I am not getting the multipart data.
So is this the right way or there is an another way to pass the multi part / form data.
//Web Config.cs File
config.Formatters.XmlFormatter.SupportedMediaTypes.Add(
new
System.Net.Http.Headers.MediaTypeHeaderValue(
"multipart/form-data"
));
//Global.Asax File
GlobalConfiguration.Configuration.Formatters.Add(new FormMultipartEncodedMediaTypeFormatter());
// Controller File
var EmailId = HttpContext.Current.Request.Params[
"EmailId"
];
var MobileNo = HttpContext.Current.Request.Params[
"MobileNo"
];
var UserName = HttpContext.Current.Request.Params[
"UserName"
];
var Password = HttpContext.Current.Request.Params[
"Password"
];
var Address = HttpContext.Current.Request.Params[
"Address"
];
var IDProof = HttpContext.Current.Request.Params[
"IDProof"
];
var VendorPhoto = HttpContext.Current.Request.Files[
"VendorPhoto"
];
If there's a solution please let me know it as soon as possible.
Reply
Answers (
1
)
Student Record Show on Grid View on DOB select
Whatsapp Api Implementation without Using Third Party API .