Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
How to Pass special character in Web API Post method?
Diptyajit Dey
7y
458
1
Reply
How to Pass special character in Web API Post method? I am saving the special character like '&',''' in web api via post method.
Problem is when I am passing the special character via parameter then special character is being removed by the Web API and the value is being saved without special character.
I have first created a Web API. Then this Web API call the your asp.net project. I am calling the Web API via Web client. Please see the exp:
string
URI = ApiBaseURL +
"project/Updateproject"
;
string
myParameters =
"ProjectId="
+ projectid +
"&ProjectStatusId="
+ projectstatusid +
"&ProjectName="
+ projectname +
"&ProjectImage="
+ fileName +
"&Description="
+
description +
"&FloorPlan="
+ floorplan +
"&ProjectAddress="
+ address +
"&ProjectCategoryId="
+ projectcategoryid +
"&CityId="
+ cityid +
"&ProjectBudgetLowPrice="
+ budgetlowprice +
"&ProjectBudgetHighPrice="
+
budgethighprice +
"&ProjectLogo="
+ ProjectLogo +
"&YoutubeLink="
+ youtubelink +
&FeaturePropertyFlag=
" + featuredpropertyflag + "
&Property=
" + property + "
&Video=" +
+
"&Phone="
+ phone +
"&SocialContactNo="
+ socialPh +
"&PpcContactNo="
+ ppcphone +
"&ThreeSixtyDegreeVideo="
+ threesixtyfilelink +
"&LoyaltyPoint="
+ loyaltypoint +
"&ProjectDurationId="
+ ProjectDurationId +
"&latitude="
+ latitude +
"&longitude="
+
longitude +
"&PhotoGallaryShrtDesc="
+ PhotoGallaryShrtDesc +
"&LocationShrtDesc="
+
LocationShrtDesc +
"&LandingViewFlag="
+ LandingViewFlag +
"&ProjectBudgetRange="
+ ProjectBudgetRange +
"&ProjectLinkId="
+ ProjectLinkId +
"&ProjectExternalLink="
+
ProjectExternalLink;
using
(WebClient wc =
new
WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] =
"application/x-www-form-urlencoded"
;
HtmlResult = wc.UploadString(URI, myParameters);
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Can we implement Alexa Voice Service in Asp.net?
Fetching data from DB by clicking on TAB in MVC.