Apr 27, 2012 at 9:28 AM
Edited Apr 27, 2012 at 9:36 AM
|
Hi everyone
Having real problems with using SiteMap.CurrentNode. In my sitemap, I have /about-us/ and a rule in my .ini that '/about-us/' rewrites to 'about-us.aspx' . However, when I call the CurrentNode in my code the server
returns about-us.aspx and produces a NullReferenceException since about-us.aspx isn't present in the sitemap file.
I found a solution for 'UrlRewritingNet' (http://markmail.org/message/wmgekwp2rv2jp4ny) but id prefer to have this working on IIRF :)
Trying to build a bread crumb!!
Thanks for any help anyone can give me!!
|
|
May 4, 2012 at 8:33 PM
Edited May 4, 2012 at 8:34 PM
|
I just resolved this very problem for one of my websites, and learned something in the process!
What you have to do is tell your form to use the Raw URL; in my case, I have a master page so I put the following code in my Master's code behind:
protected void Page_Load(object sender, EventArgs e)
{
MyForm.Action = Request.RawUrl;
}
I hope it helps!
|
|
|
|
Thanks cnavarro7. Ill tell you what i ended up doing in the end. In the sitmap file I set a new parameter Rewriteurl and used that to populate my urls. For example:
<siteMapNode title="About Us" url="~/about-us.aspx" rewriteurl="about-us/" description="About Us Description">
Worked a treat!!
|
|