I alredy used & Error doesn't shows but by giving this & the URL in the sitemapnode doesn't find and can't display the title of the sitemapnode.
I am sending values from the URL through query string to index.aspx page and I tried using %26 as mentiond above but that is not working as getting problem to retrive the query string values.
When I was trying with %26 to the <sitemapnode> it prompts me an error
The 'url' property had a malformed URL: /index.aspx?cat=Customs%26subcat=Acts.
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: /index.aspx?cat=Customs%26subcat=Acts.
SubhakarYarl...
Member
5 Points
23 Posts
How to include '&' to sitemapnode URL?
Jul 07, 2012 09:28 AM|LINK
countycowpok...
Participant
1411 Points
340 Posts
Re: How to include '&' to sitemapnode URL?
Jul 07, 2012 12:23 PM|LINK
SubhakarYarl...
Member
5 Points
23 Posts
Re: How to include '&' to sitemapnode URL?
Jul 08, 2012 03:49 PM|LINK
I alredy used & Error doesn't shows but by giving this & the URL in the sitemapnode doesn't find and can't display the title of the sitemapnode.
mbanavige
All-Star
134950 Points
15415 Posts
ASPInsiders
Moderator
MVP
Re: How to include '&' to sitemapnode URL?
Jul 08, 2012 04:11 PM|LINK
special characters in the url need to be urlencoded - which is different from htmlencoding
when urlencoded the & becomes %26
countycowpok...
Participant
1411 Points
340 Posts
Re: How to include '&' to sitemapnode URL?
Jul 08, 2012 07:14 PM|LINK
mbanavige
All-Star
134950 Points
15415 Posts
ASPInsiders
Moderator
MVP
Re: How to include '&' to sitemapnode URL?
Jul 08, 2012 09:22 PM|LINK
Sure:
http://msdn.microsoft.com/en-us/library/zttxte6w.aspx
SubhakarYarl...
Member
5 Points
23 Posts
Re: How to include '&' to sitemapnode URL?
Jul 10, 2012 06:59 AM|LINK
But the URL encode is not useful as I am giving URL at HTML. Please find the code below
I am sending values from the URL through query string to index.aspx page and I tried using %26 as mentiond above but that is not working as getting problem to retrive the query string values.
Example with %26 instead of &
while retriving the values to the index page
category = Request.QueryString["cat"];
subcategory = Request.QueryString["subcat"];
and the output is
category = "Central Excise&subcat=Acts"
subcategory = null
SubhakarYarl...
Member
5 Points
23 Posts
Re: How to include '&' to sitemapnode URL?
Jul 10, 2012 07:11 AM|LINK
When I was trying with %26 to the <sitemapnode> it prompts me an error
The 'url' property had a malformed URL: /index.aspx?cat=Customs%26subcat=Acts.
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: /index.aspx?cat=Customs%26subcat=Acts.
Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: How to include '&' to sitemapnode URL?
Jul 10, 2012 07:52 AM|LINK
This works perfectly for me (vs2008) with &. My sitemap is:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="default.aspx" title="Home">
<siteMapNode url="default.aspx?cat=Central Excise&subcat=Acts" title="Acts" />
<siteMapNode url="default.aspx?cat=Central Excise&subcat=Rules" title="Rules" />
<siteMapNode url="default.aspx?cat=Central Excise&subcat=Forms" title="Forms" />
<siteMapNode url="default.aspx?cat=Central Excise&subcat=Circulars" title="Circulars" />
</siteMapNode>
</siteMap>
On the page I have:
<div>
<asp:SiteMapDataSource ID="menuData" runat="server" />
<asp:Menu runat="server" DataSourceID="menuData" Orientation="Vertical" StaticDisplayLevels="2" />
</div>
<br />
Cat: <asp:Label ID="cat" runat="server" />
<br />
Sub: <asp:Label ID="sub" runat="server" />
And in code I have:
protected void Page_Load(object sender, EventArgs e)
{
string category = Request.QueryString["cat"];
string subcategory = Request.QueryString["subcat"];
cat.Text = category;
sub.Text = subcategory;
}
In every case the category and subcategory are passed through and extracted from the querystring correctly.
SubhakarYarl...
Member
5 Points
23 Posts
Re: How to include '&' to sitemapnode URL?
Jul 10, 2012 08:04 AM|LINK
Hi,
Working with & but URL is not finding if there is a space in the string
URl = index.aspx?cat=Central Excise&subcat=Acts
Thanks.