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);
- }