ASP.NET and Root relative paths. Am I crazy?

T

tsteinke

Okay here is the situation I am developing a ASP.Net application
locally and then I copy the project up to my web server.

I start out by creating an ASP.NET Application

http://localhost/WebApplication

that contains a folder

http://localhost/WebApplication/images

In my app I have a root relative referfer to an image
"/images/pic.gif"
(I need it to be root relative because the link is in a control that
can either be referenced by a form in the root or a subfolder, the form
has be be in a subfolder because I am using FormsAuthorization, if
there is a way to avoid this all together I would love to hear it)

Now the root relative path actually points to
http://localhost/images
not
http://localhost/WebApplication/images

which is incorrect until I copy it to the server when it points to
http://www.mysite.com/images

How the heck is this supposed to ever work?!

I assume that is why they made the "~" for Application relative paths
in ASP.NET of course then I have to turn all my html elements into
server controls, I'm still not sure if I can do it with things like the
background images of cells. And to top it off they show up as broken
links in the designer while I'm developing.

Please someone tell me they fixed this in VS2005
 
T

tsteinke

That this just doesn't work.

1. It only works on Server controls. Now every little image table etc
on my site must be a server control just so it can resolve a path.
Ignoreing the code clutter isn't there a significant performance hit
for this?

2. Sometimes it doesn't work at all, for instance I wasn't able to use
it to do things like set the background style of a cell

3. The don't show up in the designer, which I guess is a small thing,
but I then have to run ever page to make sure images line up etc, it is
a major useablity issue.( Actually while I'm on that issue the fact
that WebUsercontrols don't show up at all in the designer it pretty
ubeleiveable to me. )

I just want to know what the intended workflow is for an ASP.NET
application. Has anyone thought of this? Does Microsoft have any best
practices documentaion on this.

The only solution that I could see would be to install Windows Server
on my Dev machine and run a virtual web server for every site that I
do.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top