Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon 5 posts 25 karma points
    Dec 13, 2011 @ 22:41
    Jon
    0

    Popup to a new page outside of Umbraco project from a UserControl

    Currently I have a UserControl macroed into an Umbraco template that makes a popup call to an aspx page in abother project within the same solution as Umbraco.  The error I receive back is as follows.

    Page not found

    No umbraco document matches the url 'http://localhost:49271/job-seekers/UserControls/Jobs/JobDetails.aspx?jobID=2996'

    umbraco tried this to match it using this xpath query'/root/*/* [@urlName = "job-seekers"]/* [@urlName = "usercontrols"]/* [@urlName = "jobs"]/* [@urlName = "jobdetails"]')

    This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element.

    For more information, visit information about custom 404 on the umbraco website.

     

    The version of Umbraco we are currently using is v 4.7.1

    The call used within the usercontrol goes as follows

    <a class="popup" href='<%# "UserControls/Jobs/JobDetails.aspx?jobID=" + DataBinder.Eval(Container.DataItem,"jobID") %>'>Details</a>

    I've tried numerous entries within the web.config to resolve this issue. Such as adding the following values to the umbracoReservedUrls tag.

    ~/ODD.WorkingEd.Web.UI/UserControls/Jobs/JobDetails.aspx

    ~/UserControls/Jobs/JobDetails.aspx

    ~/~I/UserControls/Jobs/JobDetails.aspx

     

    each pretty much was met with blinding failure.  Is there something I'm just not getting??

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 13, 2011 @ 22:47
    Tom Fulton
    1

    Hi Jon,

    Are you able to browse to that URL manually in your browser?

    My guess is that you have the page stored in /usercontrols/ but your URL above is looking for /job-seekers/UserControls.  You could fix that by adding a / in front of the href.

    <a class="popup" href='/<%# 
    "UserControls/Jobs/JobDetails.aspx?jobID=" + 
    DataBinder.Eval(Container.DataItem,"jobID") %>'>Details</a>

    Also I guess it doesn't matter but I might reccomend using a different directory for your aspx pages.

    -Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 13, 2011 @ 22:51
    Jan Skovgaard
    0

    +1 on the suggestion of handling your .aspx pages in another folder than the usercontrols folder intended for Umbraco Macroes to avoid mixing things up.

    It can quickly become a bit messy and by storing your content in a custom folder in the root level you should be able to add the reservedurl in the web.config without any further problems.

    /Jan

  • Jon 5 posts 25 karma points
    Dec 13, 2011 @ 23:06
    Jon
    0

    Hi Tom,

    Thank you for your quick reply!  I'm actually taking over on a project for another developer so this wasn't my initial design.

    The hierarchy of the Projects is as follows. The containing folder (Project) has an Umbraco folder which holds the Umbraco project in a pretty standard setup but the added on files are in a UI folder at the same root level as Umbraco

     

    Project

    |_

    | Umbraco

    |

    |_ UI

           |_ UserControls

                 |_ Jobs

                      |_ JobDetails

     

    The JobSearch user control is held within the usercontrols subfolder of the Umbraco folder (not shown in my poorly made diagram) which it is macroed to a template.  I unfortunately am unable to see my page from the browser if I type the URL in manually which leads me to believe I have the extension incorrect given that there are 2 projects and that I'm running off of a macro within a template in Umbraco that's trying to point at an aspx page within a seperate project.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 13, 2011 @ 23:09
    Tom Fulton
    0

    Hmm, not sure about your project structure but it really doesn't matter that much since it's just an ASPX page.  If you look on the filesystem of the actual umbraco site, does /usercontrols/jobs/jobdetails.aspx exist?

    Can you browse to the URL above without the 'job-seekers'?  http://localhost:49271/UserControls/Jobs/JobDetails.aspx?jobID=2996

  • Jon 5 posts 25 karma points
    Dec 14, 2011 @ 14:51
    Jon
    0

    Yes.  jobdetails.aspx exists within the usercontrols folder in a compiled form.

    When removing 'job-seekers' from the URL I receive the same error page

    Page not found No umbraco document matches the url 'http://localhost:49271/UserControls/Jobs/JobDetails.aspx?jobID=2996' umbraco tried this to match it using this xpath query'/root/*/* [@urlName = "usercontrols"]/* [@urlName = "jobs"]/* [@urlName = "jobdetails"]') This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element. For more information, visit information about custom 404 on the umbraco website.

    I was told by a coworker who had previously worked on the project prior to it being split into 4 projects that the jobdetails link use to work fine prior to the split.  To be honest I'm very new to Umbraco so I'm not entirely sure of how the engine works quite yet but I feel that there must be something wrong with this section of the code.  Both folder trees in both applications have UserControls/Jobs/ however in the root of Umbraco it technically follows usercontrols/UserControls/Jobs

                            <ItemTemplate>
                                <a class="popup" href='<%# "UserControls/Jobs/JobDetails.aspx?jobID=" + DataBinder.Eval(Container.DataItem,"jobID") %>'>Details</a>
                            </ItemTemplate>

     

    Given that structure and the reservedURL of ~/ODD.WorkingEd.Web.UI/UserControls/Jobs/JobDetails.aspx doesn't seem to be blocking Umbraco as well as using the path UserControls/Jobs/JobDetails.aspx?jobID=2996 doesn't allow for a manual view of my file in the UI project I feel that there is something wrong with the pathing that I'm overlooking

  • Jon 5 posts 25 karma points
    Dec 14, 2011 @ 15:23
    Jon
    0

    Ok so I made a folder at the root level of umbraco called Testing. 

     By blocking out the Testing folder on reservedURLs and using this URL I am able to finally see the JobDetails page. 

    http://localhost:49271/Testing/JobDetails.aspx?jobID=2998

    Good news is at least the page functions correctly so the problem goes back to How do I reference it from outside of the Umbraco project?  Or is it too much of a hassle to deal with and I should try to convince my boss to allow me to redo the structure of the projects.

    It might also be important to note that

    http://localhost:49271/Testing/JobDetails.aspx?jobID=2998 may work however when I changed the string to "Testing/JobDetails.aspx?jobID=" + DataBinder.Eval(Container.DataItem,"jobID") I was met with the following path http://localhost:49271/job-seekers/Testing/JobDetails.aspx?jobID=2995which as you can guess is broken. I tried to make the path relative to roll it up a folder but it keeps converting the relative paths into literals

    http://localhost:49271/job-seekers/~/Testing/JobDetails.aspx?jobID=2995

  • Jon 5 posts 25 karma points
    Dec 14, 2011 @ 15:44
    Jon
    0

    We decided to take the easy route and move all the pages into the folder I made at the root level of the Umbraco project and to scrap the other project. Thanks for all your help!

Please Sign in or register to post replies

Write your reply to:

Draft