peteski
peteski

Reputation: 1523

ASP.NET SiteMap control invalid XHTML -title contains &

I'm using the .SiteMap file and Sitemap control to create a sitemap on a page. The title of the page in the Web.sitemap is: "Out & About".

When the page renders, the ampersand is shown as an & (Out & About) in the source, this obviously then causes validation errors.

Any ideas how I can force good ol' .net sitemap to encode the ampersand as I entered it into the title.

As usual, thanks for any help. peteski

Upvotes: 1

Views: 559

Answers (1)

Richard
Richard

Reputation: 108975

Use HttpUtility.HtmlEncode to encode your text first, this will emit the appropriate entities (in this case "&amps;").

Upvotes: 1

Related Questions