Root Folder for Web Application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?R3JlZw==?=

    Root Folder for Web Application

    I have the following line of code in my MasterPage.Mast er file. It's a link
    to ensure the web-sites default.aspx page in the root folder will always
    load.

    <a href="~/Default.aspx" >Home</a>

    But, I've tried using it in pages that are in sub-folders and it returns an
    error page. I get the 404 error as follows:

    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: /WestChicago/~/Default.aspx

    I know I'm close to having this right. I thought the tilda (~) specified the
    root folder and thus ~/default.aspx would load the page from any website
    folder. Plus, I need this to ensure all of my other links start from the root
    folder as well when needed.

    What am I doing wrong?

    Thanks.
  • Nathan Sokalski

    #2
    Re: Root Folder for Web Application

    The ~ can only be used in URLs for server controls, not static html. You can
    use the HyperLink server control, or you can use the ResolveUrl method to
    programmaticall y assign the url. Good Luck!
    --
    Nathan Sokalski
    njsokalski@hotm ail.com
    有声小说网为广大读者提供热门小说在线免费阅读,本站收集的网络文学小说情节跌宕起伏,有声小说网是值得书友们收藏的小说在线阅读网。


    "Greg" <AccessVBAnet@n ewsgroups.nospa mwrote in message
    news:76ED04E3-4201-4543-85A2-AF485D13FBEE@mi crosoft.com...
    >I have the following line of code in my MasterPage.Mast er file. It's a link
    to ensure the web-sites default.aspx page in the root folder will always
    load.
    >
    <a href="~/Default.aspx" >Home</a>
    >
    But, I've tried using it in pages that are in sub-folders and it returns
    an
    error page. I get the 404 error as follows:
    >
    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: /WestChicago/~/Default.aspx
    >
    I know I'm close to having this right. I thought the tilda (~) specified
    the
    root folder and thus ~/default.aspx would load the page from any website
    folder. Plus, I need this to ensure all of my other links start from the
    root
    folder as well when needed.
    >
    What am I doing wrong?
    >
    Thanks.

    Comment

    Working...