Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex Maghen - 16 Feb 2008 10:58 GMT
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
Scott Roberts - 16 Feb 2008 16:08 GMT
>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
[quoted text clipped - 25 lines]
>
> 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").
Alex Maghen - 17 Feb 2008 05:37 GMT
Scott -

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

Alex

> >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
[quoted text clipped - 32 lines]
> You can also convert the virtual path at runtime using
> Server.MapPath("~/Default.aspx").

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.