Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 6th, 2004, 07:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

>when I finish I will change the virtual root of the local website

You'll have to change all the paths in .cs files, .aspx files, .ascx files, and some paths stored in the DB if you want that to work. If you want to use a hosted site, you should make these changes. The cheap hosted sites don't allow you to set up virtual directories.

>I will be using relative URLs like "images/thePhile.gif" not "/thePhile/images/thePhile.gif"?

Image paths are always a subject of debate. If you use relative paths, they have to be relative to the current folder you are in with that particular page. This is always hard to do with user controls, since they will be loaded from various folders.

I changed all of my images to use one image folder, directly under the virtual root. And I use fully quailifed pathnames. I'm not saying this is the ideal solution, but rather I was getting frustrated with image path issues and I just wanted to fix it once and for all.

Most people recommend using separate image folders for each subdirectory, which is what ThePhile has now. This works good if you're patient and you are careful how you specify paths. Since this application is just a hobby for me, I don't want to spend that much time with it.

Eric
 
Old October 6th, 2004, 11:34 AM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Eric,

 Maybe the Images path are confusing let's talk about soemthing else
now we have http://localhost/thePhile which map to the c:\thePhile (for example).

 My idea is that I will be refering to files like "default.aspx" or refer to a folder inside that virtual directory "books/getbooks.aspx" ok?
now when I deploy the website I will have a domain name like www.thephile.com and I will map it to thePhile folder (which will be the virtual root on the hosting space, as I think?????) and now all my paths are going to work fine right? because it's still relative to the current directory which is a virtual directory on my PC (http://localhost/thePhile) and will be a virtual root when I deploy it (www.thephile.com)??

please tell me if I understand that right or not?
Thanks for your great help
Marenela

 
Old October 6th, 2004, 03:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you are missing this concept. If you deploy to a virtual root folder, then your main page is this:

http://www.thephile.com/Default.aspx

and NOT this:

http://www.thephile.com/ThePhile/Default.aspx

Eric
 
Old October 6th, 2004, 05:07 PM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes it's http://localhost/thePhile/Default.aspx in my machine because I created a virtual directory which is c:\thePhile but when I will deploy it I will create ONLY a virtual root and make it point to the folder of the application which is thePhile folder so it will be a virtual directory on my machine but a virtual root on the host space. What do you think?
Thanks,
Marenela

 
Old October 6th, 2004, 09:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How can the same application use 2 different paths without making any changes?

I will give you another example that might make this more clear to you. Lets pretend you have a simple application that always reads a disk file at this path (assume that the pathname and filename are hardcoded in your program):
c:\dirname1\dirname2\file.txt

Then later I move the file to this folder:
c:\dirname1\file.txt

Your program will not be able to open the file unless you change the pathname in your source code and then recompile the application.

That's what I'm trying to tell you. The application has many pathnames hardcoded. If you change the folder where the application lives, then all the hardcoded pathnames have to be changed.

Eric
 
Old October 7th, 2004, 03:37 AM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes I understand that very clear but I'm using paths like "files/file.aspx" not "thePhile/files/file.aspx" so it's relative to the current folder right? so what I want to do is map that folder to be a virtual directory on my machine (as they do in the book) but when I deploy it it will be the virtual root of the application.

 WHAT I THINK is that because I used relative URLs the app will work well. that's what I want to know.
Thanks again
Marenela

 
Old October 15th, 2004, 10:20 AM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

 I can't think about a solution for the URL problem in thePhile :(. Please if anybody have a reference so I can understand URL Basics I will be greatful.

Thanks,
Marenela

 
Old December 1st, 2004, 11:22 AM
Authorized User
 
Join Date: Nov 2003
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to seanmayhew
Default

I hate this issue because it forces you to use /thePhile/ for the paths unless you want to make this your only localhost site. So if you work on multiple web sites the paths always become a mess.

What have others who work on multiple sites done about this? I prefer doing my paths from root rather than relative but this seems impossible. I had my host create a virtual directory pointing to /thePhile as the root of my site although they've never done this before and perhaps understand it less than I but that means to point to anything I end up having to put /thePhile/thePhile/.

Anybody familiar with this?

 
Old December 1st, 2004, 11:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

>I prefer doing my paths from root rather than relative but this seems impossible

Not impossible - just a little harder. Once you have the application converted it is easy to maintain that way.

>I end up having to put /thePhile/thePhile/

They (or you) made a mistake! Have you read my other posts here about virtual directories? It's a very simple concept. It's just an alias for a Windows folder that will be visible in "web space", that is, anything with "http://" in front of it.

Think of a postal example. Let's say your address is 98501 Adams street. And there's about a dozen people who live on your street, but the house numbers are large. Let's say you get a new mailman on your block, and he's an elementary school dropout. He keeps getting confused about the numbers.

To help him out, the postmaster comes out and pastes a big letter on each person's mailbox: "A", "B", etc. These are the "virtual" addresses that the mailman can understand. We'll call this the "big bird" address space.

Then the postmaster will sort through the mail before it leaves the station and he'll paste alphabetic letters on each envelope: "A", "B", etc. The mailman only has to match up the letters and he can easily deliver the mail to the right house.

We have 2 completely different address spaces, but one is an alias for the other. The real house addresses are like the Windows folders. The "A", "B", etc are like the virtual directories. Any given virtual directory must map to a real folder on the hard disk. The names do NOT have to match.

If any address has "http:" in front of it, then IIS is responsible to map that to a Windows folder on the hard disk.

You really need to nose around in the IIS control panel applet, under Administrative tools. Open the node for your default web site. You will see a list of virtual directories there. Pick one, right click, properties, then look at the "local path". That tells you how it maps to your associated Windows folder.

Let's say you have a virtual dir called "ThePhile", and it lives on your hard disk in c:\wrox\ThePhile. If you hit this in a browser:
"http://localhost/ThePhile/Default.aspx",
then it is going to fetch this file on your hard disk:
"c:\wrox\thephile\Default.aspx"

It's really not that hard! Please play around with IIS and look at all of the settings and properties.

Eric
 
Old December 2nd, 2004, 04:34 PM
Registered User
 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think what is meant is, that if i use a virtual directory for development , so http://localhost/thephile/
in my code i have /thephile/.....

when i move this to a host, it will be called www.thephile.com
this means i have to go through the whole app and change the /thephile/ just to /default.aspx or what ever the path is.

isnt there a better way to do this, cant we use ./ or anything??

what if i change the name of the virtual directory, i have to change all those occuracnes of it.

??

Sian Mace





Similar Threads
Thread Thread Starter Forum Replies Last Post
Base URLs - FCKeditor retroviz BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 9th, 2008 02:23 AM
Automatic URLs bodenzord Forum and Wrox.com Feedback 2 January 4th, 2005 04:19 PM
urls muhammadtahir4000 HTML Code Clinic 1 December 9th, 2004 04:41 AM
Complex URLs wells XSLT 3 June 16th, 2004 04:17 AM
Automatic URLs Imar Forum and Wrox.com Feedback 13 June 19th, 2003 03:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.