Master Pages and content pages in subfolder

V

vikramp

Hi,

I am still new to ASP.NET 2.0 and trying to develope something using
Master pages.

My problem is:
I have a master page that contains Logo image and a navigation menu at
the top of the page so that this will be displayed on all the content
pages automatically.
This works fine for the content pages that are stored in the same
folder as that of Master page.

But I have a content page that is stored in a sub-folder (not in the
same folder as that of master page). Because of this, the contents
inherited from the master page (images/hyperlinks on master page) are
not rendered on content page. The reason being their relative paths
become invalid as my content page is inside a sub-folder.

How to resolve this issue? Do I have to mention the path for images
(and other relative paths) on master page using some different
technique (using ~ or something of that sort?)


thanks.
 
M

Mark Rae

How to resolve this issue? Do I have to mention the path for images
(and other relative paths) on master page using some different
technique (using ~ or something of that sort?)

Do yourself a *HUGE* favour and design your web app so that everything is at
the same level off the root, e.g.

<root>
\bin
\css
<stylesheets go here>
\folder 1
<content goes here>
\folder 2
<content goes here>
\folder n
<content goes here>
\includes
<include files e.g. JavaScript etc go here>
\master
<master pages go here>
default.aspx
Global.asax
Web.config
 
A

apathetic

vikramp said:
But I have a content page that is stored in a sub-folder (not in the
same folder as that of master page). Because of this, the contents
inherited from the master page (images/hyperlinks on master page) are
not rendered on content page. The reason being their relative paths
become invalid as my content page is inside a sub-folder.

<img runat="server" src="~/images/my-pic.jpg" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top