Solved

XML escape character (&) in writing web services.

Posted on 2008-06-12
1
1,634 Views
Last Modified: 2008-06-13
Suppose I'm writing a web service:

string TestService()
{
...
}

Currently, a client calling the service will get the result string as (If saving the result string as result.xml and opened in XML browser):
Company & Country

instead of Company & Country.

Do I need to write a line at the end of the service something like this:
RegEx.Replace("&", "&");

What is the best way to deal with the 5 XML escape characters in designing my web services so that my service can be consumed without problems for the web services clients with different platforms?
Thanks!
0
Comment
Question by:heyday2004
1 Comment
 
LVL 18

Accepted Solution

by:
philipjonathan earned 500 total points
ID: 21776312
Check out System.Web.HttpUtility class. There are many useful functions there. It should be HtmlEncode() that you are looking for.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question