Getting "The resource cannot be found" using href=

T

Tony Girgenti

Hello.

I have an ASP.NET 2.0 web site with a master page that works fine when i
test it in VS2005, but when i upload it to a live isp site, it gives the
error at the end of this post for one of the links. Here is the line that
has the link:
<div class="readmore"><a href="/CoyneWebServices/File
Maintenance/Warehouses.aspx" title="More info">&raquo; more</a></div>

I tried putting a tilde"~" after the href=", but it won't allow that line in
the source view.

I also tried using:
<div class="readmore"><a href="CoyneWebServices/File
Maintenance/Warehouses.aspx" title="More info">&raquo; more</a></div>

<div class="readmore"><a
href="http://www.tonygirgenti.info/CoyneWebServices/File
Maintenance/Warehouses.aspx" title="More info">&raquo; more</a></div>

<div class="readmore"><a href="/File Maintenance/Warehouses.aspx"
title="More info">&raquo; more</a></div>

Any help would be gratefully appreciated.

Thanks,
Tony



Server Error in '/' Application.
--------------------------------------------------------------------------------

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: /CoyneWebServices/File Maintenance/Warehouses.aspx
 
T

ThatsIT.net.au

/CoyneWebServices/File Maintenance/Warehouses.aspx

your link starts with a "/" this means "CoyneWebServices" is a folder in the
root directory, but this may not be the case on your isp.

You may need to use the "../../" addressing

if you have say
/folder1/folder2

and
/folder3/folder4

and you had a file in folder4 that linked to a file in folder2 you would use

.../../folder1/folder2

and you had a file in folder3 that linked to a file in folder2 you would use

.../folder1/folder2
 
M

Mark Rae [MVP]

I have an ASP.NET 2.0 web site with a master page that works fine when i
test it in VS2005, but when i upload it to a live isp site, it gives the
error at the end of this post for one of the links. Here is the line that
has the link:
<div class="readmore"><a href="/CoyneWebServices/File
Maintenance/Warehouses.aspx" title="More info">&raquo; more</a></div>

1) Are you sure it actually exists on the live server...?

2) You have spaces in your URL - avoid that if you possibly can

3) You appear to have omitted the question mark at the beginning of the
QueryString...
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Tony said:
Hello.

I have an ASP.NET 2.0 web site with a master page that works fine when i
test it in VS2005, but when i upload it to a live isp site, it gives the
error at the end of this post for one of the links. Here is the line that
has the link:
<div class="readmore"><a href="/CoyneWebServices/File
Maintenance/Warehouses.aspx" title="More info">&raquo; more</a></div>

I tried putting a tilde"~" after the href=", but it won't allow that line in
the source view.

You need to put runat="server" in the tag to be able to use the tilde.
The server translates the tilde url to an actual url, so the control has
to be a server control.

<a href="~/CoyneWebServices/File%20Maintenance/Warehouses.aspx"
title="More info" runat="server">&raquo; more</a>

As mark mentioned, an URL should not contain spaces. Although most
browsers doesn't care, a correct URL may not contain spaces.
 
T

Tony Girgenti

Hello ThatsIT.

Using your logic, if i have off of the root
"FileMaintenance/Warehouses.aspx"(i removed the space), from the
AppMaster.master(which is in the root), i use
<a href="/FileMaintenance/Warehouses.aspx" title="More info">&raquo;
more</a>

This works OK when uploaded to live site, but does not work when i run it
from VS2005.

Why is that?

Thanks,
Tony
 
T

Tony Girgenti

Hello Mark.
Not sure of what you mean by this. I can see it on the web site using ftp.
I uploaded the whole site using ftp. Its there.
2) You have spaces in your URL - avoid that if you possibly can
Removed spaces.
3) You appear to have omitted the question mark at the beginning of the
QueryString...
What query string?

Thanks,
Tony
 
M

Mark Rae [MVP]

Not sure of what you mean by this. I can see it on the web site using
ftp. I uploaded the whole site using ftp. Its there.

And is it where it should be in the folder hierarchy...?
What query string?

Apologies - I didn't read your OP closely enough...
 
T

Tony Girgenti

Hello Goran.

I removed the space and added runat="server" like this:
<a href="~/CoyneWebServices/FileMaintenance/Warehouses.aspx" title="More
info" runat="server">&raquo; more</a>

This still does not work. The source view does not allow it. When i hover
the mouse pointer over it, it says "File
'~/coynewebservices/filemaintenance/warehouses.aspx' was not found."

Thanks,
Tony
 
T

ThatsIT.net.au

Tony Girgenti said:
Hello ThatsIT.

Using your logic, if i have off of the root
"FileMaintenance/Warehouses.aspx"(i removed the space), from the
AppMaster.master(which is in the root), i use
<a href="/FileMaintenance/Warehouses.aspx" title="More info">&raquo;
more</a>

This works OK when uploaded to live site, but does not work when i run it
from VS2005.

Why is that?


FileMaintenance/Warehouses.aspx

is relitive from where you lcik the link

/FileMaintenance/Warehouses.aspx

is from the root always
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Tony said:
Hello Goran.

I removed the space and added runat="server" like this:
<a href="~/CoyneWebServices/FileMaintenance/Warehouses.aspx" title="More
info" runat="server">&raquo; more</a>

This still does not work. The source view does not allow it. When i hover
the mouse pointer over it, it says "File
'~/coynewebservices/filemaintenance/warehouses.aspx' was not found."

Thanks,
Tony

Acccording to your other posts in the thread, the CoyneWebServices is
not a folder in your solution.

The tilde represents the root folder in your application, not the root
folder of the web, so you should remove CoyneWebServices from the url.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top