BryanHood Posted April 17, 2006 Share Posted April 17, 2006 I am not sure if I should be asking this question here, or in the ASP forum, but here goes (I am using ASP.NET 2.0 / C# from Visual Studio 2005):I seem to be having problems calling pages/images/etc... by starting at the "Root" level of my web page.I have nested folders, and I seem to be having problems accessing things in other folders.Example (folder structure) Root|+--Images|+--Tools | +--Tools Folder 1 | +--Tools Folder 2 My "Root" has a Master Page that I call. This in turn calls an Image from the /Images folder.I have no problems calling pages, and using the Master if I am in the Tools Folder. I access those pages as "~/Images/<image>.gif"When I use my Master Page from a page located in "~/Tools/Tools Folder 1/<page>.aspx, I get the "Broken Image" icon.Is there a way for me to declare a "Base" reference, and base all of my calls off of that?Thank You, Bryan Clauss Link to comment Share on other sites More sharing options...
aspnetguy Posted April 17, 2006 Share Posted April 17, 2006 can you post the .aspx and .aspx.cs files so we can see how you have Master Pages setup Link to comment Share on other sites More sharing options...
BryanHood Posted April 17, 2006 Author Share Posted April 17, 2006 Here is a page that is 2 levels deep. If I have a page that is only 1 level deep, it will work fine.The images in the Master have their source set to src="../images/Logo_Trans_white.gif". I tried to use "~/Images/...", but it would not work at all.I haven't tried to add code to the below page, but I am willing to bet that my CSS sheets won't pull.Thanks again!"Root" / Tools / Discrepancies / DiscrepAdd.aspx <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="DiscrepApprove.aspx.cs" Inherits="Tools_Discrepancies_DiscrepApprove" Title="Untitled Page" %><%@ MasterType VirtualPath="~/MasterPage.master" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server"></asp:Content> "Root" / MasterPage.master <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %><%@ Register Src="~/SharedControls/UserInfo.ascx" TagName="UserInfo" TagPrefix="uc1" %><%@ Register Src="~/SharedControls/Menu.ascx" TagName="MyMenu" TagPrefix="ucMenu" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <!-- <title>Untitled Page</title> --> <link href="~/Styles/styles.css" media="screen" rel="stylesheet" type="text/css"> <link href="~/Styles/stylesPrint.css" media="print" rel="stylesheet" type="text/css"></head><body style="margin: 0px; "> <form id="frmMaster" runat="server"> <div id="Header" style="z-index: 115; position: absolute; float:left; top: 0px; left: 0px; background-color: #999999; width: 100%; height: 95px;"> <img src="../images/Logo_Trans_white.gif" style="z-index: 106; left: 0px; position: absolute; top: 0px;" /> <div style="z-index: 108; background-image: url('../Images/bevel.gif'); width: 100%; height: 5px; left: 0px; position: absolute; overflow: hidden; top: 68px"> </div> <div style="z-index: 105; background-image: url('../Images/PurpleSpong.jpg'); height: 6px; width: 100%; left: 0px; position: absolute; overflow: hidden; top: 71px"> </div> <div style="z-index: 105; position: absolute; top: 77px; left: 0px; background-color: #E5E5E5; width: 100%; height: 15px;"> </div> </div> <div id="Content" style="z-index: 105; "> <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server" /> </div> <div id="Footer" class="FooterText" style="z-index: 105; "> <div style="z-index: 105; background-image: url('../Images/PurpleSpong.jpg'); height: 6px; width: 100%; left: 0px; position: relative; overflow: hidden; top: 0px"> </div> <div style="z-index: 108; background-image: url('../Images/bevel.gif'); width: 100%; height: 5px; left: 0px; position: relative; overflow: hidden;"> </div> <div style="z-index: 105; position: relative; left: 0px; background-color: #999999; width: 100%; height: 35px;"> <div class="FooterText" style="top: 0px; position: absolute; width: 100%;"> <table height="35px" width="100%"> <tr> <td width="50%" align="left" style="vertical-align: bottom;"> Ver: <asp:Label ID="PageName" runat="server" Text="MasterPage"></asp:Label> </td> <td align="right" style="vertical-align: bottom;" width="50%"> Updated: <asp:Label ID="LastMod" runat="server" Text="today"></asp:Label> </td> </tr> </table> </div> </div> </div> </form></body></html> Link to comment Share on other sites More sharing options...
pulpfiction Posted April 17, 2006 Share Posted April 17, 2006 If you want to save the base url and use it for every url, then try this, add this in the web.config file<configuration> <appSettings> <add key="BasePath" value="http://localhost/foldername/"/> </appSettings>And to get the value from Application's Configuration Settings, using System.Configuration;string aURL;aURL = ConfigurationSettings.AppSettings.Get("BasePath"); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now