473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

"~" in Visual Studio and "~" in real IIS

I am confused about something: Let's say I have a web application I've
developed and it's sitting in a directory called "Docroot". In that Docroot
folder is a Web.config and a Default.aspx.

Whe I run the application from within Visual Studio (2008), the URL in IE
when it runs is:
http://localhost:2635/Docroot/Default.aspx
with the "Docroot" directory included in the URL.

But, of course, when I run it in IIS (outside of Visual Studio), the URL of
the "base" of the application will be
http://localhost/Default.aspx
without the "Docroot" directory showing.

This poses a little problem for me in development:

Let's say I want to build my application so that I can rewite the URL of the
site from within the application based on runtime properties. The problem is,
I don't know how to rebuild the path of "~" because it'll be different if
it's running in VS as opposed to normally in IIS.

Is there a way to "know" this in runtime? And why *is* it different anyway?

Alex
Feb 16 '08 #1
2 1123

"Alex Maghen" <Al********@newsgroup.nospamwrote in message
news:9E**********************************@microsof t.com...
>I am confused about something: Let's say I have a web application I've
developed and it's sitting in a directory called "Docroot". In that
Docroot
folder is a Web.config and a Default.aspx.

Whe I run the application from within Visual Studio (2008), the URL in IE
when it runs is:
http://localhost:2635/Docroot/Default.aspx
with the "Docroot" directory included in the URL.

But, of course, when I run it in IIS (outside of Visual Studio), the URL
of
the "base" of the application will be
http://localhost/Default.aspx
without the "Docroot" directory showing.

This poses a little problem for me in development:

Let's say I want to build my application so that I can rewite the URL of
the
site from within the application based on runtime properties. The problem
is,
I don't know how to rebuild the path of "~" because it'll be different if
it's running in VS as opposed to normally in IIS.

Is there a way to "know" this in runtime? And why *is* it different
anyway?

Alex
I'm not sure why it's different, but you can change it in VS by clicking
your web site in the Solution Explorer then setting the "Virtual Path"
property in the Properties window (to, say, "/").

You can also convert the virtual path at runtime using
Server.MapPath("~/Default.aspx").

Feb 16 '08 #2
Scott -

Thanks. I didn't know you could change this Virtual Path value in VS. That
make things a LOT easier.

Alex

"Scott Roberts" wrote:
>
"Alex Maghen" <Al********@newsgroup.nospamwrote in message
news:9E**********************************@microsof t.com...
I am confused about something: Let's say I have a web application I've
developed and it's sitting in a directory called "Docroot". In that
Docroot
folder is a Web.config and a Default.aspx.

Whe I run the application from within Visual Studio (2008), the URL in IE
when it runs is:
http://localhost:2635/Docroot/Default.aspx
with the "Docroot" directory included in the URL.

But, of course, when I run it in IIS (outside of Visual Studio), the URL
of
the "base" of the application will be
http://localhost/Default.aspx
without the "Docroot" directory showing.

This poses a little problem for me in development:

Let's say I want to build my application so that I can rewite the URL of
the
site from within the application based on runtime properties. The problem
is,
I don't know how to rebuild the path of "~" because it'll be different if
it's running in VS as opposed to normally in IIS.

Is there a way to "know" this in runtime? And why *is* it different
anyway?

Alex

I'm not sure why it's different, but you can change it in VS by clicking
your web site in the Solution Explorer then setting the "Virtual Path"
property in the Properties window (to, say, "/").

You can also convert the virtual path at runtime using
Server.MapPath("~/Default.aspx").

Feb 17 '08 #3

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

Similar topics

1
by: Seth Guard | last post by:
(Sorry for the cross-post, but no one responded to my other thread.) When developing a web page in VS.Net, I see everything in WYSIWYG format. And when I am creating a User Control, I see that...
2
by: Chris Herring | last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag and drop weenie, not a real programmer. So I tend to get confused when things do not look like the instructions said they...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
7
by: lukaslatz | last post by:
Hi group I'm fed up with the Altova Mapforce user forum because posts go missing and it's slow. Is there a group especially for vendor-specific topics/issues or are these things ok in...
11
by: Tolga | last post by:
After a very rapid entrance into the Python, I have immediately looked for a good IDE. Komodo and Wing IDE look very good and I think they are enough. But now, I am searching for a Pyhton...
6
by: Zero | last post by:
Hi C-community! How do I start the program MyProg.exe with the parameter "Tuesday 2006", which can be found in the folder "Microsoft Visual Studio"? I want to use the function excel from...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.