Solved

Ampersand character in SiteMapNode string

Posted on 2009-03-30
9
1,077 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 9

Expert Comment

by:cdaly33
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
What is the equivalent of %40?
0
 

Author Comment

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Learn new improvements released by Google for Google Calendar. Noted in this article are simple tips and tricks that can make your everyday use of Google Calendar better.
Working with spreadsheets can be a daunting task, especially when having to deal with large amounts of data. All you see are rows and rows of numbers and soon your eyes begin to glaze over. Take advantage of the tools in Google Sheets to create prof…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
This Micro Tutorial will demonstrate Google Calendar to monitor updates with top sites, such as Facebook, Google, Twitter, etc. with Marketing News. Each update of Google Calendar can be monitored, correlate dips and spikes in your website traffic, …

772 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

10 Experts available now in Live!

Get 1:1 Help Now