views:

318

answers:

2

hello. when I create folder for every page and remap those in web.config , appeared this problem .

1)I can't see content of pages.

2)When I use navigation controls , my web.SiteMap don't work and don't show path of pages.

what is problem in my project , and what I solve that ?

this link is my web site :

Urlmapping code :

<urlMappings>
  <add url ="~/HOME" mappedUrl ="~/Default.aspx"/>
  <add url ="~/a" mappedUrl ="~/a.aspx" />
  <add url ="~/a1" mappedUrl ="~/a1/a1.aspx"/>
  <add url ="~/a2" mappedUrl ="~/a2/a2.aspx"/>
  <add url ="~/b" mappedUrl ="~/b/b.aspx"/>
  <add url ="~/b1" mappedUrl ="~/b1/b1.aspx"/>
  <add url ="~/b2" mappedUrl ="~/b2/b2.aspx"/>
  <add url ="~/b3" mappedUrl ="~/b3/b3.aspx"/>
  <add url ="~/c" mappedUrl ="~/c/c.aspx"/>
  <add url ="~/c1" mappedUrl ="~/c1/c1.aspx"/>

    </urlMappings>

SiteMap code :

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

<siteMapNode url="~/HOME" title="Home"  description="Home Page">

  <siteMapNode url="~/a" title="page a" description="page a">
    <siteMapNode url="~/a1" title="page a-1" description="page 1 of a" />
    <siteMapNode url="~/a2" title="page a-2" description="page 2 of a"/>
  </siteMapNode>

  <siteMapNode url="~/b" title="page b" description="page b">
    <siteMapNode url="~/b1" title="page b-1" description="page 1 of b" imageTitle="lake"/>
    <siteMapNode url="~/b2" title="page b-2" description="page 2 of b" imageTitle="wolf"/>
    <siteMapNode url="~/b3" title="page b-3" description="page 3 of b" imageTitle="thunder"/>
  </siteMapNode>

  <siteMapNode url="~/c" title="page c" description="page c">
    <siteMapNode url="~/c1" title="page c-1" description="page 1 of c"/>
  </siteMapNode>

</siteMapNode>
A: 

The problem is that the Url your are wanting is a actual folder in your wbesite so IIS picks this up first. There are acouple of ways to get around this.

  • Change all the .aspx filenames to be Default.aspx and these will be picked when you type http://website/a for example if you have a folder called "a" with Default.aspx in it, remove all the entries in the urlMappings
  • Have the URL as a different name to a actual directory
  • Use ASP.Net URL Routing that has been introduced in 3.5 SP1 look at Chis Cavanagh blog post on it.
  • Use as Jose mentioned the ReWritter
Jon Morley-Jones
now my urlmapping is work but web.sitemap don't work. what do I do ?
mohammad reza
A: 

I can solve my problem .

you should create folder whit name Default and create page whit name default too and then use web.sitemap in navigation controls .

mohammad reza