By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

Master Pages and content pages in subfolder

P: n/a
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.

Oct 13 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"vikramp" <vp****@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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
Oct 13 '06 #2

P: n/a
vikramp wrote:
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" />

Oct 13 '06 #3

P: n/a
Hi apathetic,

thanks for the solution. It worked fine using ~ to specify the path.
apathetic wrote:
vikramp wrote:
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" />
Oct 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.