IDE and folders

IDE and folders

am 01.01.2008 19:32:41 von dli

We have a web app developed in Visual Studio 2003 v 7.1.3 using Framework
1.1.4


When running the project in the IDE on a shared development server running
Windows 2003 and IIS 6.0 or my local machine which is XP and IIS 5.1, I have
the following problem:

Since we are developing multiple sites on the same machine, each website has
its own folder under the default website in IIS. When the project is
compiled and the website is viewed via a browser, the root relative paths to
images and redirects all work fine. When we use the IDE to debug or run the
project, the root relative paths do not work correctly. This makes debugging
and testing a real chore since we use a lot of shared controls and shared
images and we have two folders protected by forms authentication.



Is there a way to tell the IDE to use a specific folder as the root for root
relative paths?


TIA

Re: IDE and folders

am 01.01.2008 19:49:47 von dli

Here is an example of what I am encountering:


In IDE clicking this link generates:

http://localhost/services/Login.aspx

generates an error because it can't find the file

the url is missing the folder MySite so I need to plug it in the url on the
browser

http://localhost/MySite/services/Login.aspx


On server using Internet explorer and IIS generates:

http://MySite/services/Login.aspx

which works as it should.

How do I get the IDE to add the root folder name of each seperate site?

Re: IDE and folders

am 02.01.2008 11:58:56 von Hans Kesting

DLI wrote :
> Here is an example of what I am encountering:
>
>
> In IDE clicking this link generates:
>
> http://localhost/services/Login.aspx
>
> generates an error because it can't find the file
>
> the url is missing the folder MySite so I need to plug it in the url on the
> browser
>
> http://localhost/MySite/services/Login.aspx
>
>
> On server using Internet explorer and IIS generates:
>
> http://MySite/services/Login.aspx
>
> which works as it should.
>
> How do I get the IDE to add the root folder name of each seperate site?

I guess you are using a URL "/services/Login.aspx" ?

Some options:

1) use a real relative path "../services/Login.aspx", but you need to
work out how many "../" you need (and that can be different for
different forms)
2) for "runat=server" controls (like LinkButtons), use the
"~/services/Login.aspx" syntax. That "~" is translated into the current
application-root, so debugging will use 'http://localhost/MySite' and
on the server it will use 'http://MySite'.

For 2) note that the translation is done server-side. It only works for
URLs in Web- or html-controls with runat=server, it does not work for
URLs that are used in plain html text.

Hans Kesting

Re: IDE and folders

am 02.01.2008 17:21:00 von dli

I understand using document relative links would work for some situations,
but we have some user controls that live in a sub-folder that are used by
parent pages in different folders. The document relative reference will
break for these pages. The reference to images in the user control depends
upon which folder the parent page is in.
What I was looking for was some way to keep the pages in our development
environment the same as the production environment. Currently, we have to
debug with one syntax (document relative) in our devlopment environment,
then deploy the page and change the references on the production server to
root relative.

I just wondered if anyone knew of a better method or whether a newer version
of Visual Studio handles it better.

Thanks!



"Hans Kesting" wrote in message
news:mn.12ce7d812b25dbcc.82533@spamgourmet.com...
> DLI wrote :
>> Here is an example of what I am encountering:
>>
>>
>> In IDE clicking this link generates:
>>
>> http://localhost/services/Login.aspx
>>
>> generates an error because it can't find the file
>>
>> the url is missing the folder MySite so I need to plug it in the url on
>> the browser
>>
>> http://localhost/MySite/services/Login.aspx
>>
>>
>> On server using Internet explorer and IIS generates:
>>
>> http://MySite/services/Login.aspx
>>
>> which works as it should.
>>
>> How do I get the IDE to add the root folder name of each seperate site?
>
> I guess you are using a URL "/services/Login.aspx" ?
>
> Some options:
>
> 1) use a real relative path "../services/Login.aspx", but you need to work
> out how many "../" you need (and that can be different for different
> forms)
> 2) for "runat=server" controls (like LinkButtons), use the
> "~/services/Login.aspx" syntax. That "~" is translated into the current
> application-root, so debugging will use 'http://localhost/MySite' and on
> the server it will use 'http://MySite'.
>
> For 2) note that the translation is done server-side. It only works for
> URLs in Web- or html-controls with runat=server, it does not work for URLs
> that are used in plain html text.
>
> Hans Kesting
>
>

Re: IDE and folders

am 03.01.2008 09:45:47 von Hans Kesting

DLI used his keyboard to write :
> I understand using document relative links would work for some situations,
> but we have some user controls that live in a sub-folder that are used by
> parent pages in different folders. The document relative reference will break
> for these pages. The reference to images in the user control depends upon
> which folder the parent page is in.
> What I was looking for was some way to keep the pages in our development
> environment the same as the production environment. Currently, we have to
> debug with one syntax (document relative) in our devlopment environment, then
> deploy the page and change the references on the production server to root
> relative.
>
> I just wondered if anyone knew of a better method or whether a newer version
> of Visual Studio handles it better.
>
> Thanks!
>

Wat about option 2 (the "~")?

One trick we used to get relative paths working both in development and
"live" was to set all pages at exactly two directories deep, so
"../../" always pointed to the application root. From that point you
can use a "root-relative" path.

I don't think it is something that can be easily solved by some
development environment: the problem is due to the nature of
web-applications where pages need separate resources (images, css
files, js files, etc).

Hans Kesting

>
>
> "Hans Kesting" wrote in message
> news:mn.12ce7d812b25dbcc.82533@spamgourmet.com...
>> DLI wrote :
>>> Here is an example of what I am encountering:
>>>
>>>
>>> In IDE clicking this link generates:
>>>
>>> http://localhost/services/Login.aspx
>>>
>>> generates an error because it can't find the file
>>>
>>> the url is missing the folder MySite so I need to plug it in the url on
>>> the browser
>>>
>>> http://localhost/MySite/services/Login.aspx
>>>
>>>
>>> On server using Internet explorer and IIS generates:
>>>
>>> http://MySite/services/Login.aspx
>>>
>>> which works as it should.
>>>
>>> How do I get the IDE to add the root folder name of each seperate site?
>>
>> I guess you are using a URL "/services/Login.aspx" ?
>>
>> Some options:
>>
>> 1) use a real relative path "../services/Login.aspx", but you need to work
>> out how many "../" you need (and that can be different for different forms)
>> 2) for "runat=server" controls (like LinkButtons), use the
>> "~/services/Login.aspx" syntax. That "~" is translated into the current
>> application-root, so debugging will use 'http://localhost/MySite' and on
>> the server it will use 'http://MySite'.
>>
>> For 2) note that the translation is done server-side. It only works for
>> URLs in Web- or html-controls with runat=server, it does not work for URLs
>> that are used in plain html text.
>>
>> Hans Kesting
>>
>>