Solved

Ampersand character in SiteMapNode string

Posted on 2009-03-30
9
1,078 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
  • 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
 

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
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Last month, Google released a new update for Google Sheets. This new update offers new ways to visualize and analyze data. Use this article to learn how to take advantage of the new tools now available for charts, cells and collaboration with Google…
Google Forms is a great platform to easily create polls, questionnaires and surveys. The service allows you to receive data in real-time and is a simple way to conduct large-scale surveys that can be distributed to multiple people.   The platform …
This Micro Tutorial will introduce a Google tool, which is a great way to learn more about dimensions in metrics in Google Analytics, even if you use the interface or the API.
This Micro Tutorial will demonstrate how to analyze your website's back links using a network graph powered by a fusion table.

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now