Paths in .net 2

R

Robert Mago

While developing a web project, when a debug run is attempted the Visual
Studio 2005 creates a Virtual Server and runs the said Web Site on it, hence
eliminating the local host or the Proper path of the Site and instead starts
off on the Folder of the said site.

Now, suppose that we have a common area where the common images, htm files
and other miscellaneous files are present, which has nothing to do with the
said project, but contains some objects which will have to be included in
the said Web Site using only relative paths. ["../../thing.htm"]

In the 'old' Visual Studio 2003, this was possible since the Web Site was
run on localhost. How can this be achieved in Visual Studio 2005?

Below is a sample scenario:

Local host in IIS is set to "C:/Development"

Common items found at "C:/Development/DotNet2/Common"

Website found at "C:/Development/DotNet2/Website"


Visual Studio 2003

When running the Site, the path of the page becomes
http://localhost/DotNet2/Website/Default.aspx

The Common Objects could be by using the
"../Common/thing.htm"


Visual Studio 2005

When running the Site, the path of the page becomes
http://localhost:2773/Website/Default.aspx

How can I access the Common objects found within the
DotNet2/Common using relative paths only?

Thanks
 
M

Marc Gravell

Cassini (the virtual server you are seeing) is for small projects
without IIS. To do what you want, go into the properties popup and
change the Start Options > Server > Use custom server >
http://localhost/PathTo/TheRoot/OfYourApp

When you build and debug it should now run via IIS, so any virtual
folders or folders outside your project root should now be visible. It
also means you can test more security etc options.

Marc
 

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

Top