Link to home
Start Free TrialLog in
Avatar of Goalie3533
Goalie3533

asked on

asp.net/ajax: unable to locate root directory on httphandler webpage?!?

Hello.

I'm using DotNetBlogEngine as my infrastructure for an asp.net 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 http://97.74.54.51/default.aspx (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:
ImageUrl="~/Images/TemplateImages/ad.jpg"

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

Thanks.
Avatar of lotusnotesnewbie
lotusnotesnewbie
Flag of India image

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

ASKER

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.
         <asp:ScriptManager 
            ID="ScriptManager1" 
            runat="server" 
            EnablePartialRendering="true" 
            LoadScriptsBeforeUI="false" 
            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">
<Triggers>
     <asp:AsyncPostBackTrigger
          ControlID="lnkOpenClose"
          EventName="Click" />                        
</Triggers>  
<ContentTemplate>
     <asp:Panel ID="pnlDefault" runat="server" Visible="true">
         <table width="100%">
              <tr>
                   <td align="center" valign="middle">
                        <asp:Image ID="imgAd" runat="server"    
                        ImageUrl="~/images/templateimages/ad.jpg" />
                   </td>
              </tr>
         </table>
     </asp:Panel>                                                    
     <asp:Panel ID="pnlMenuOptions" runat="server" Visible="false">
            ....PANEL CONTENT HERE....          
     </asp:Panel>
 
------------------------------------------
c# code:
    protected void lnkOpenClose_Click(object sender, EventArgs e)
    {
        if (pnlMenuOptions.Visible == true)
        {
              pnlMenuOptions.Visible = false;
              pnlDefault.Visible = true;
        }
        else
        {
              pnlMenuOptions.Visible = true;                           
              pnlDefault.Visible = false;
        }
     }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Goalie3533
Goalie3533

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial