473,657 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Sep 22 '08 #1
1 2565
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
nj********@hotm ail.com
http://www.nathansokalski.com/

"Greg" <Ac**********@n ewsgroups.nospa mwrote in message
news:76******** *************** ***********@mic rosoft.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.

Sep 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3665
by: Leszek | last post by:
Hello, Could anybody explain what's a difference between a virtual directory and an application root under IIS? I'm a little bit confused. This is mu problem: Let's assume the following directory structure: FileManager (application name a.k.a. virtual directory?)
1
5334
by: John Dalberg | last post by:
I have an asp.net app that is in a folder which is two levels under the website root folder. The website has a login.aspx which is in the root folder. How do I get the relative path to the web site root folder (not the curent app folder)? A generic one that works no matter how deep the folder is in the folder heirarchy --
19
10207
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However when I deploy to a remote test server running real IIS, the real root of my application becomes: http://localhost/ What I want to do is have it so that on my local machine the asp.net dev
3
1700
by: Nalaka | last post by:
Hi, I have an asp.net web application (www.myWebSite), and a subweb application (www.myWebSite/subSite). How do I set it so that, subweb application (www.myWebSite/subSite) be the root application..... so that, when a user types www.myWebSite/subSite, it actualy, shows pages off subweb.
9
6395
by: Benny Ng | last post by:
Hi,all, How to let the sub-directory to avoid the authentication control from Root's webconfig? I heard that we can add a new web.config to the sub-directory. And then we can slove the problem. Virtual directory is £ºhttp://localhost/main Sub-directory is : http://localhost/main/reminder
2
2518
by: gurnandank | last post by:
Hi, I have a web application which uses SSL on one the folders. When I developed application the set up was webroot and under that folder called 'secure'. My ISP has provided a folder called 'secure' on the server which has shared SSL and is sitting outside of the web root, hence the set up called 'secure' and then at the same level a folder called web root. Now, I have two issues:
2
1962
by: Jeff Brown | last post by:
Hi, I suspect that this isn't possible, but I figured I'd ask. My project has a root namespace, let's say it's "Root", that applies to almost every source file (which is why I've set it as the project's root namespace). However, the project also includes a couple of source files whose contents will live in an entirely different namespace, let's say the "Special"
0
1612
by: Carl Gilbert | last post by:
Hi I am trying to get a simple ASP.NET web application to work on my 1&1 (1and1) web space. I managed to get something working a while ago, with thanks to Karl Seguin, but for some unknown reason it stopped working. I have two domains: www.airbrushesonline.com which is directed at a folder on my web space called 'tm' www.airbrushesonline.co.uk which is directed at a folder on my web space
2
1604
by: Chris | last post by:
I have a web app which sit in a virtual but is a sub folder of the web tree. I thought if I put the web.config in the virtual it would read from there but it seems to only accept it if the web.config is in the root. Does my application's virtual have to be configured as an application. Will this cause any problems sharing things like sessions across different virtuals configured as different applications. Regards, Chris.
3
2597
by: Chris | last post by:
I have created a site with VS2005, using asp.net/c#. When I try to deploy this site to our intranet asp server all of my links that were "~/Folder/Site.aspx" no longer work because when I move it to production it says that it cannot find the site. So I'm working on a site on my own local PC which looks like this: C: \ASP.net Website When I move it to my production environment I copy to a folder X: \MetaDim\Main where X is my mapped...
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.