Using N2 to override existing content

Topics: Developer Forum
Oct 21, 2008 at 2:23 PM
I am implementing N2 on a website with existing file-based content. If I create a /page.aspx using N2 and there is a pre-existing physical file called page.aspx, the physical file "wins" when mysite.com/page.aspx is requested by a web browser.

Can I reverse this behavior? In other words, I would prefer to see the N2 managed content for "page.aspx" rather than the content generated by the physical page.aspx file when I go to mysite.com/page.aspx.

Thanks -

-James
Coordinator
Oct 21, 2008 at 5:01 PM
Not in the released version, but I like the idea. I just committed this configuration option which should work the way you want:

  <n2>
    <host>
      <web ignoreExistingFiles="true" />

Oct 28, 2008 at 3:35 PM
Thanks libardo!

What is the best way to incorporate this? Do you know when this feature will be "released"?

-James
Coordinator
Nov 1, 2008 at 5:22 PM
You could pick the code from source control and compile yourself.
Nov 4, 2008 at 6:20 PM
Ok, thanks! The checkout is processing as I type this :)

Is there anything I should know about code on the trunk? I was hoping to stick with a release version of N2, so I am a little apprehensive.

Thanks

-James
Nov 4, 2008 at 8:10 PM
> <web ignoreExistingFiles="true" />

Hi libardo,

I have updated my project with the code from the trunk. This feature seems to work for files but not folders. For example, if I create a page at mysite.com/hello (no file extension) and I also have a "hello" folder then I see a directory listing for the hello folder instead of the N2 content page. However if then add mysite.com/hello/world.aspx this successfully overrides the physical world.aspx file.

I browsed the N2 code and the PathIsRewritable function looks correct so I'm not sure why this wouldn't work for directories. Any help you can provide is greatly appreciated.

Thanks!

-James
Nov 5, 2008 at 8:54 PM
Edited Nov 5, 2008 at 8:54 PM
I was looking to do something similar, have you found a way override a directory, so I dont see the directory listing?

Thanks
Daniel
Coordinator
Nov 5, 2008 at 9:14 PM
Are you certain this occurs in production? I noticed this in the visual studio dev server but not in IIS.
Nov 6, 2008 at 12:06 PM
> Are you certain this occurs in production?

I just tried in production and the behavior is correct. Thank you very much!