比如现在a.master放在root目录下
root目录下有一个它的内容页aa.aspx
root/a目录下有一个它的内容也bbbb.aspx
现在和master在同一级目录下的内容页能显示图片而和master不再同以及目录下的内容也就没有办法显示图片了,css也是用不了,怎么办?

解决方案 »

  1.   

    请使用站点根路径
    如:
    /image/aaa.jpg
      

  2.   

    将需要共享的css,图片等资源放到网站的同一个目录下,然后master和子页面里面对此进行引用。
    例如网站根目录下有个resource目录,这里面放置的是你共享的资源site.css,master里面就
    <link href="resource/Site.css" rel="stylesheet" type="text/css" />
    其他页面也是这样引用
      

  3.   

    恩,我确实是这样做了,但是和master页面不在同一级的内容页就不显示其他和master页面处于同一级目录的内容页就好着。奇怪的很以前没怎么用这个东西,现在发现不懂得地方还真是多
      

  4.   

    不行用个笨方法。 在其他用到模板页的文件下面都考过来一遍图片CSS 或者按照3楼的那样做
      

  5.   

    呵呵,找到答案了“I think you use HTML Controls so ASP.NET can not resolve URL automatically. This might answers your question:In server controls on master pages, ASP.NET dynamically modifies the URLs of properties that reference external resources. For example, you might put an Image control on a master page and set its ImageUrl property to be relative to the master page. At run time, ASP.NET will modify the URL so that it resolves correctly in the context of the content page.ASP.NET cannot modify URLs on elements that are not server controls. For example, if you use an img element on a master page and set its src attribute to a URL, ASP.NET will not modify the URL. In that case, the URL will be resolved in the context of the content page and create the URL accordingly.In general, when working with elements on master pages, it is recommended that you use a server control, even for elements that do not require server code. For example, instead of using an img element, use an Image server control. That way, ASP.NET can resolve URLs correctly and you can avoid maintenance issues that might arise if you move the master or content page.
    ”“You replace<table>     <tr>          <td background="UploadedImages/p04.gif">some thing</td>     </tr><table> by the code:<asp:table runat="server" ID="table1" >    <asp:tablerow>          <asp:tablecell BackImageURL="UploadedImages/p04.gif">          </asp:tablecell>    </asp:tablerow></asp:table>”
      

  6.   

    1 不要使用HTml控件
    2 在每个contentpage上都应用绝对路径