Solved unable to locate root directory on httphandler webpage?!?

Posted on 2009-02-09
Last Modified: 2012-05-06

I'm using DotNetBlogEngine as my infrastructure for an blog website.  DotNetBlogEngine creates "fake" pages for all blog articles and category pages.  The problem is, when I integrate ajax into one of these "fake" httphandler pages, and then execute the ajax (a button click event in this case), I get errors related to being unable to locate the root directory....

 If you check out my site at (not much to look at.  Just wanted to upload to show the error) , then click the square, blue button on the top right called "Click Here", you'll notice you can click it over and over with no problem.  The content in the blue bar successfully switches back and forth.

Now, however, if you click on the "General" link under "Categories" on the left hand side of the page, this page leads to the error I'm having.  If you click the blue square again on this General page, it works fine the 1st click however the 2nd click should return an invalid image URL when trying to display the original phone advertisement again.  Notice the URL of this page is called "category/General.aspx"?  This page doesn't actually exist.  It's a "fake" page DotNetBlogEngine creates via httphandlers.  Now, if you right click on the invalid image, the URL it displays is "category/images/templateimages/ad.jpg" .  The correct path should not have "category" in it.  

 My imagepath in my image control looks like the following:

Any idea what may be causing this to not look in the root directory?

Question by:Goalie3533
    LVL 4

    Expert Comment

    Could you tell what script you are writing in Click Here? Are you changing the ImageURL manually anywhere in the code?

    Author Comment

    Hi lotusnotesnewbie.  Thanks for the reply.

    I've attached the code I use to execute this (also included my scriptmanager).  Strange thing is I'm not doing too many crazy things.  I just basically have two panels.  One's always visible & the other's invisible when the button (lnkOpen_Close) get clicked.

    I'd greatly appreciate any extra help or advice you can offer.

    Thanks again.
                ScriptMode="Release" />
    <asp:LinkButton ID="lnkOpenClose" runat="server" OnClick="lnkOpenClose_Click" Width="136" Height="145" CssClass="OpenCloseButton"></asp:LinkButton>
    <asp:UpdatePanel ID="OnPageMenuUpdatePanel" runat="server" UpdateMode="Conditional">
              EventName="Click" />                        
         <asp:Panel ID="pnlDefault" runat="server" Visible="true">
             <table width="100%">
                       <td align="center" valign="middle">
                            <asp:Image ID="imgAd" runat="server"    
                            ImageUrl="~/images/templateimages/ad.jpg" />
         <asp:Panel ID="pnlMenuOptions" runat="server" Visible="false">
                ....PANEL CONTENT HERE....          
    c# code:
        protected void lnkOpenClose_Click(object sender, EventArgs e)
            if (pnlMenuOptions.Visible == true)
                  pnlMenuOptions.Visible = false;
                  pnlDefault.Visible = true;
                  pnlMenuOptions.Visible = true;                           
                  pnlDefault.Visible = false;

    Open in new window


    Accepted Solution

    I was able to resolve this error with a solution from someone else.  Here's the solution they posted:

    I was able to reproduce the problem you're having on my local machine.

    The problem is that when you're on the category page, the first time you do an UpdatePanel button click, the async postback is correctly being done to "category/BlogEngineNET.aspx", but the response coming back to the page includes a new 'formAction' with a value like '../default.aspx?id=19770e74-9ec9-4cde-b2ab-e5051aaaf348'.  Then the next time you do an UpdatePanel button click, the async postback is being incorrectly done to ../default.aspx?id=19770e74-9ec9-4cde-b2ab-e5051aaaf348.

    I did this Google search and found one solution that solved the problem (there may be other solutions too -- didn't search for very long).  The solution I found was here.  If you add JeffreyZhao's code somewhere in your page, it fixes it so the async postbacks are done to the correct url.  I added his code right before the closing <body> tag.

    <script type="text/javascript">
            var form = Sys.WebForms.PageRequestManager.getInstance()._form;
            form._initialAction = form.action = window.location.href;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now