Hello,

I developed a website in which I added a master page,header and footer.
In the header, I added a code but its not working fine because the pages that I am adding are in another folders as shown below...

<li><a href="Home.aspx">Home</a></li>
<li><a href="KMApps/KMAppsHome.aspx">Applications</a></li>

As you can see that KMAppsHome.aspx is contained in a folder named KMApps but as I run this application the images of Header.ascx are not shown in KMAppsHome and when I click back on Home.aspx it displays Error 404 Page Not Found.

I've also used relative paths like ../KMApps/KMAppsHome.aspx instead of KMApps/KMAppsHome.aspx but the problem is still same.

Please help me.

Thanks in advance.

Please reply anyone...I think its a path problem only...

Thanks in advance.

Use ASP.NET server control (HyperLink)

<li><a runat="server" href="~/Home.aspx">Home</a></li>
<li><a runat="server" href="~/KMApps/KMAppsHome.aspx">Applications</a></li>

Thanks adatapost but what about the images?
I mean I used <img> and its working fine that is the images are being shown with src="~/Images/..." but in the master page I used <div> for ContentPlaceHolder,Header,Footer and Sidebar and there I used

<div style="background-image:url(~/Images/...)" runat="server">
<asp:ContentPlaceHolder ID="KMContents" runat="server">
</asp:ContentPlaceHolder>
</div>

but in this the same problem is occuring that is the images disappear when I click on KMAppsHome.aspx Link which is located in the folder KMApps/KMAppsHome.aspx

Thanks in advace.

~ - is root operator only used for asp.net and html server controls. You can not use root operator for style-sheet attributes. You need to organize your folder/files (resources) according their usage.

Could you please tell me that how can I, in this case, apply a background image in ContentPlaceHolder that will be displayed in all the pages ?

Hi adatapost could you please provide me the solution quickly or anyone else ?

Thanks in advance.

Please help me someone its damn urgent.

Thank you very much in advance.

use ../path (absolute path) in the Style Sheets for images and other media files.
use ~/path (relative path) in the server web pages links for navigation.

its always better to re-organize the entire project structure and test it locally before proceeding further, if it will not take much time.

Just drag the Image Path From the Solution Explore .Check whether images are loading or not.. if it is loding the images then change path to ../Images

Thanks nebyas and prateekpk5 for your replies but I'm still facing problems with ~/ and ../
Anyways, I am reorganizing my web contents once again and see if that works.

Thanks.

Sorry to all the experts but this is not working.
Anyways I'll try to organize me contents once again properly.
Thanks to all for their kind help.

The error may be due to the reason that may be the requested page is set to offline. Just check that in the menu. Hope it will work

Thanks

Nope its not working.

Thanks a lot for your kind replies however I suppose that it was a content-organizing problem but anyways I've rearranged my contents accordingly...Let me see what I can do for it now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.