Getting The resource cannot be found using href=

Discussion in 'ASP.NET 2.0' started by Tonyg, Aug 5, 2007.

  1. Hello.

    ** Sorry for posting this again, but the original post lost the proper subject title. **

    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 my discountasp.net 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">&amp;raquo; more</a></div>

    I tried putting a tilde"~" after the href=", but it gives an error for that line.

    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

    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
     
  2. '~' will only work for server side controls i.e During the compilation process of the server-side control, ASP.NET will translate that ~ into Request.ApplicationPath.Since you are using a simple html hyperlink to specify a relative path(depending on your applications structure),use something like ,

    href="../CoyneWebServices/File Maintenance/Warehouses.aspx (links up one directory )
    href="../../CoyneWebServices/File Maintenance/Warehouses.aspx (links up two directories ) etc.







    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Hello Vikram.


    In my root, i have AppMaster.Master, which has this in it:
    <a href="/FileMaintenance/Warehouses.aspx" title="More info">&amp;raquo; more</a>


    Also from the root, i have FileMaintenance/Warehouses.aspx.


    When uploaded to live site, this works OK, but does not work if i test from VS2005.


    Thanks,
    Tony
     
  4. Its a relative path w.r.t your root so it should work fine in both the cases.How are you doing it from VS 2005? 'View in Browser' option?

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page