> These are the buttons that don't work. They function fine as long as I'm
> on
> a page that's in the root, but as soon as I'm on a page that's in a
> subdirectory, they throw an error.
As a general rule in a technical newsgroup, there's very little point in
saying something like "they throw an error" if you don't actually tell the
group what the error is - I wrote some code this morning but, when I ran it,
it threw an error - what could the problem be...?
Please say what the error is that you're getting...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Keith G Hicks - 29 Feb 2008 16:03 GMT
Don't answer people if all you can be is rude. I thought I stated the
problem pretty clearly in the original post and that because asp.net is new
to me I wasn't sure what to ask about exactly. I said "it cannot find the
page." I figured I didn't need to repeat that in my follow up. Iv'e been
writing and answering newsgroup messages for years in microsoft, borland and
various 3rd party tools. I don't need a scolding on how to be clear in a
post. I read posts all the time that are so far from clear that it's
laughable. Same for a lot fo the answers I see. I figured this is a common
issue and describing the fact that I have img controls on the master page
wiht <a href... /> links in them and that they can't navigate back up to the
root directory when on a page that's in a subfolder was super clear and
probably something that is easy for experienced asp.net folks (especially
MVP's) to solve. Does anyone have a helpful answer to my problem?
And if it helps, here's all the error info:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.
Requested URL: /Website1/LoggedInUsers/Home.aspx
---------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
The page "Home.aspx" is actually in the root ("Website1"), not in the
"LoggedInUsers"
directory.
Keith
> > These are the buttons that don't work. They function fine as long as I'm
> > on
[quoted text clipped - 12 lines]
> ASP.NET MVP
> http://www.markrae.net
Mark Rae [MVP] - 29 Feb 2008 16:15 GMT
> And if it helps, here's all the error info:
It does.
> The resource cannot be found.
> Description: HTTP 404. The resource you are looking for (or one of its
[quoted text clipped - 4 lines]
>
> Requested URL: /Website1/LoggedInUsers/Home.aspx
Looks very much like you have a relative addressing problem. One of the
resources that your page is looking for is not in the folder where the code
is expecting to find it...
Simplest way to track it down would be to do a View Source on the page where
the error occurs and inspect the URL paths in the HTML output...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Keith G Hicks - 29 Feb 2008 19:03 GMT
I changed the url in the images so they include the root hard coded into
them (I added /MySiteRoot/ to the href).
<a href="/MySiteRoot/Home.aspx"
onmouseover="setOverImg('1','');"onmouseout="setOutImg('1','');"target="">
<img runat="server" src="MasterPageSideButtons/button1up.png" border="0"
id="button1" vspace="1" hspace="1">
</a>
That did the trick. I read that I also needed runat="server" in the img tags
for images that are on the master page otherwise they won't show up when
viewing a content page in a subfolder. That handled that problem. Before I
did that, the image MasterPageSideButtons/button1up.png didn't appear
because it's in a folder above the page i was viewing. Would something
similar handle the problem above (the one I originally posted about) or was
adding /MySiteRoot/ the correct thing to do?
Keith
> > And if it helps, here's all the error info:
>
[quoted text clipped - 20 lines]
> ASP.NET MVP
> http://www.markrae.net
Mark Rae [MVP] - 29 Feb 2008 19:37 GMT
>I changed the url in the images so they include the root hard coded into
> them (I added /MySiteRoot/ to the href).
[quoted text clipped - 14 lines]
> was
> adding /MySiteRoot/ the correct thing to do?
The easiest thing to do would be to use webcontrols e.g. <asp:HyperLink> or,
as you say, to add runat="server" to the HTML controls and to use the tilde
(~) character as shorthand for the virtual root rather than hard-coding it
by name:
http://www.google.co.uk/search?sourceid=navclient&hl=en-GB&ie=UTF-8&rlz=1T4GZEZ_
en-GBGB252GB252&q=%22ASP%2eNET%22+tilde

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net