locked
ABSOLUTE VS. RELATIVE PATHS/LINKS RRS feed

Answers

  • User1320044578 posted

    within your own application you should use relative path and if you have to use your page in other application domain then you should use absolute path 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 9, 2013 10:42 AM
  • User-183374066 posted

    Salam Waqar,

    In my opinion you should use Absolute path 

    Advantages you get

    1. Suppose you change your pages folder than absolute path will work. You don't need to reset. but in case of relative paths you have to reset all the paths

    2. Suppose you implement routing in your application than still your images/links path valid. In case of relative paths its hell to figure out path with routing

    Some people say on different forums that using absolute path cause performance but it's this much minor even someone cann't feel it.

    You can use ResolveUrl method for absolute path

    see

    http://weblogs.asp.net/fmarguerie/archive/2004/05/05/avoiding-problems-with-relative-and-absolute-urls-in-asp-net.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 9, 2013 11:03 AM
  • User-1716253493 posted
    use absolute link if you link to another server like http:// www.microsoft.com/help/articles/ how-do-i-set-up-a- webpage.html mean the file not in your server and never change when you move the page. If the file is in your app, better use relative path. You dont need to change the path if you move the app to another place/server.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 9, 2013 11:06 AM

All replies

  • User1320044578 posted

    within your own application you should use relative path and if you have to use your page in other application domain then you should use absolute path 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 9, 2013 10:42 AM
  • User-183374066 posted

    Salam Waqar,

    In my opinion you should use Absolute path 

    Advantages you get

    1. Suppose you change your pages folder than absolute path will work. You don't need to reset. but in case of relative paths you have to reset all the paths

    2. Suppose you implement routing in your application than still your images/links path valid. In case of relative paths its hell to figure out path with routing

    Some people say on different forums that using absolute path cause performance but it's this much minor even someone cann't feel it.

    You can use ResolveUrl method for absolute path

    see

    http://weblogs.asp.net/fmarguerie/archive/2004/05/05/avoiding-problems-with-relative-and-absolute-urls-in-asp-net.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 9, 2013 11:03 AM
  • User-1716253493 posted
    use absolute link if you link to another server like http:// www.microsoft.com/help/articles/ how-do-i-set-up-a- webpage.html mean the file not in your server and never change when you move the page. If the file is in your app, better use relative path. You dont need to change the path if you move the app to another place/server.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 9, 2013 11:06 AM