Results 1 to 2 of 2

Thread: Automatic page ID's

  1. #1
    Join Date
    May 2005

    Default Automatic page ID's


    A question about the feature that automatically assigns an object ID to pages defined in the application context: how can you have multiple pages with the same base name in a web app?

    I noticed that when I have a page:

    <object type="~/Path1/ProcessData.aspx"> ... </object>

    then it doesn't matter what URL I use to refer to this page, I can use any path as long as it ends with "/ProcessData.aspx". This means that I can't have another page object like this:

    <object type="~/Path2/ProcessData.aspx"> ... </object>

    because it has the same auto-ID as the first one, overwriting the registration of the first page. I tried specifying a distinct ID in both objects, but then it seems I have to use that ID to invoke the page as well, in which I could just as well name both pages differently in the first place.

    Any suggestions?


  2. #2
    Join Date
    Sep 2004
    Belgrade, Serbia


    Solution to your problem is to use hierarchical contexts and put each page definition in a different context.

    For example, instead of creating definitions for both pages in root Web.config (or external file referenced from it), you should create separate Web.config files within Path1 and Path2 directories and place appropriate definitions within those files.

    There will be no id clashes because sibling contexts don't see definitions from one another. On the other hand, PageHandlerFactory will always try to lookup page definition in the most specific context (the one that is defined in the page directory) if one exists, and only if it doesn't find definition there it will look it up in the parent or root context.

    What we will probably do before official release is create a strategy interface for page id determination from the URL. Default implementation will continue to exhibit the current behavior, but you will be able to create your own implementation that calculates page id any way you want.

    That said, approach mentioned above should solve your problem and is a recommended way of building Spring.Net web applications because it allows easy information hiding between various components while still providing easy access to common objects defined in the root application context.



Similar Threads

  1. Replies: 3
    Last Post: 04-15-2008, 02:38 PM
  2. Possibility to delete DataBindings
    By sir-archimedes in forum Web
    Replies: 7
    Last Post: 05-06-2006, 07:33 AM
  3. Front Controller vs Page Controller
    By jross in forum Web
    Replies: 1
    Last Post: 02-19-2006, 09:18 AM
  4. HTTP 404 in SpringAir when launching start page
    By scottnelsonsmith in forum Web
    Replies: 3
    Last Post: 12-17-2005, 01:28 PM
  5. Master Page Example
    By rivaaj in forum Web
    Replies: 5
    Last Post: 05-15-2005, 03:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts