Solved

Ampersand character in SiteMapNode string

Posted on 2009-03-30
9
1,084 Views
Last Modified: 2014-11-12
Is it possible to have an entry in a sitemapnode stringan amerpsand as in

<siteMapNode url="http://www.foo.com/default.asp?src=foo.com&ctz=America/New_York" title="test"  roles="*" description="test" />

I seem to need this to reference a Google calendar within a menu.
0
Comment
Question by:steve_webber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 9

Expert Comment

by:cdaly33
ID: 24021593
Is it giving you an error?  If so, what's the error.  Usually you'd want to html escape any special characters in there so & becomes &amp;


<siteMapNode url="http://www.foo.com/default.asp?src=foo.com&amp;ctz=America/New_York" title="test"  roles="*" description="test" />

Open in new window

0
 

Author Comment

by:steve_webber
ID: 24021942
The message I get is

The 'url' property had a malformed URL: http://www.google.com/calendar/embed?src=pghsnc1hg8slhvnag0qo4rsilg%40group.calendar.google.com&ctz=America/New_York.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Configuration.ConfigurationErrorsException: The 'url' property had a malformed URL: http://www.google.com/calendar/embed?src=pghsnc1hg8slhvnag0qo4rsilg%40group.calendar.google.com&ctz=America/New_York.

I get the same error when I use "&amp;" instead of "&".

Is there some mode of Visual Studio where "&" characters are treated in some special way?
0
 
LVL 9

Expert Comment

by:cdaly33
ID: 24022165
Interesting.  Are you saying that you don't get the error when not including the ampersand? I know the url then won't get you to where you want to be but it would help to know if the error goes away without the ampersand.
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 

Author Comment

by:steve_webber
ID: 24022216
The error does go away without the ampersand, but of course it doesn't work at the web site. If I cut and paste the exact string and place it in a browser, it works -- with the ampersand.
0
 
LVL 9

Expert Comment

by:cdaly33
ID: 24022277
From what this link says you should also be able to use the code #38; in place of the ampersand.
http://www.devcurry.com/2009/02/putting-ampersand-sign-in-sitemapnode.html
0
 

Author Comment

by:steve_webber
ID: 24022337
The #38 has the same problem. I tried changing the %40 that Google told me to put in. That is the culprit. Without that character, it gets by Visual Studio and ASP.NET, but, of course, fails at he Google site.
0
 
LVL 9

Accepted Solution

by:
cdaly33 earned 250 total points
ID: 24022381
Last suggestion I have is doing the same as the bottom of this thread, remove all %'s by replacing with their real values.
http://forums.asp.net/p/1334915/2687072.aspx
0
 

Author Comment

by:steve_webber
ID: 24022439
What is the equivalent of %40?
0
 

Author Comment

by:steve_webber
ID: 24022499
The %40 is an @ sign. When I used that, all worked.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Learn about cloud computing and its benefits for small business owners.
First of all let me say that the only language that I speak is English, but in answering questions here I often come across people whose English skills are not the best and I’d like to be able to communicate better with them, and the following descr…
This Micro Tutorial will demonstrate the easy use of Gmail embedding images in your email so the recipient of your email can view them in context.
This Micro Tutorial will demonstrate how to analyze your website's back links using a network graph powered by a fusion table.
Suggested Courses

636 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