|
List Info
Thread: VS.NET, Default Web Site, and relative paths...
|
|
| VS.NET, Default Web Site, and relative
paths... |

|
2006-12-21 13:50:53 |
The ~/ will work for HTML controls as long as you add
runat="server" to
the control. Usually whenever I add
runat="server" to a control just so
that I can use ~/ then I also make sure to add
EnableViewState="false".
The problem that you'll notice is that this works great for
images and
hyperlinks when used with the traditional <a> or
<img> tags. The method
breaks down in table cells or any control that allows you to
specify
background images. i.e.
<td runat="server"
enableviewstate="false"
background="~/images/background1.gif"></td&g
t;
This example won't work.
There are a couple of other items that won't work by adding
runat="server", notably client side <script>
tags the reference a js
file, because adding runat="server" to a client
side script tag gives
the control a whole new meaning. i.e.
<script language="javascript"
src="~/scripts/my.js"></script>
Also you'll have problems w/ <link> tags that
reference .css style
sheets.
Hopefully this might help you some. At least you won't have
to convert
all your <IMG> to <asp:Image> and <a href>
to <asp:HyperLink> tags...
Good Luck
MK
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web
[mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Ben Joyce
Sent: Thursday, December 21, 2006 6:00 AM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] VS.NET, Default Web Site, and
relative
paths...
I suppose I could use an ASP Server Image control for all my
images,
seems a bit of an overkill though.
On 12/21/06, Ryan Heath <ryan.q.heath gmail.com> wrote:
> In web pages/controls code, you can use
ResolveUrl("~/yourpath") too.
>
> HTH
> // Ryan
>
> On 12/21/06, Ben Joyce <ben.joyce gmail.com> wrote:
> > Hi all. Thanks for the replies, I trawled through
my application
> > making all the required changes.
> >
> > It's a bit frustrating; I can use the ~/ in
client-side paths for
CSS
> > for not for JavaScript files, also it does not
work for IMG tags but
> > does for the server-controls.
> >
> > Oh well.
> >
> > Ben
> >
> > On 12/14/06, Fritts,Jordan <JFritts learn.colostate.edu> wrote:
> > > Ben,
> > >
> > > I know exactly what you're talking about, and
there is any easy
way
> > > around it. I haven't used .NET for some time,
but I just did this
on my
> > > machine.
> > >
> > > Instead of entering "http://localhost/",
just delete the trailing
slash
> > > so you have "http://localhost"
> > >
> > > Thanks,
> > > Jordan
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r) http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
http://discuss.develop.com
> > >
> >
> > ===================================
> > This list is hosted by DevelopMentor(r) http://www.develop.com
> >
> > View archives and manage your subscription(s) at
http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
|
| VS.NET, Default Web Site, and relative
paths... |

|
2006-12-21 17:36:56 |
If you want to support absolute paths, for example:
<script
src="/scripts/my.js"></script>
You can use this new feature of VS 2005 SP1 that I blogged
about yesterday: http://weblogs.asp.net/scottgu/archive/20
06/12/19/tip-trick-how-to-run-a-root-site-with-the-local-web
-server-using-vs-2005-sp1.aspx This enables you to run
the built-in VS web-server as a root web-site.
Alternatively, you can convert the web-site from being a
file-system to an HTTP web-site and run it that way: http://weblogs.asp.net/scottgu/archive/2005/08/23/4
23409.aspx
Hope this helps,
Scott
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web [mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: Thursday, December 21, 2006 5:51 AM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] VS.NET, Default Web Site, and
relative paths...
The ~/ will work for HTML controls as long as you add
runat="server" to
the control. Usually whenever I add
runat="server" to a control just so
that I can use ~/ then I also make sure to add
EnableViewState="false".
The problem that you'll notice is that this works great for
images and
hyperlinks when used with the traditional <a> or
<img> tags. The method
breaks down in table cells or any control that allows you to
specify
background images. i.e.
<td runat="server"
enableviewstate="false"
background="~/images/background1.gif"></td&g
t;
This example won't work.
There are a couple of other items that won't work by adding
runat="server", notably client side <script>
tags the reference a js
file, because adding runat="server" to a client
side script tag gives
the control a whole new meaning. i.e.
<script language="javascript"
src="~/scripts/my.js"></script>
Also you'll have problems w/ <link> tags that
reference .css style
sheets.
Hopefully this might help you some. At least you won't have
to convert
all your <IMG> to <asp:Image> and <a href>
to <asp:HyperLink> tags...
Good Luck
MK
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web
[mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Ben Joyce
Sent: Thursday, December 21, 2006 6:00 AM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] VS.NET, Default Web Site, and
relative
paths...
I suppose I could use an ASP Server Image control for all my
images,
seems a bit of an overkill though.
On 12/21/06, Ryan Heath <ryan.q.heath gmail.com> wrote:
> In web pages/controls code, you can use
ResolveUrl("~/yourpath") too.
>
> HTH
> // Ryan
>
> On 12/21/06, Ben Joyce <ben.joyce gmail.com> wrote:
> > Hi all. Thanks for the replies, I trawled through
my application
> > making all the required changes.
> >
> > It's a bit frustrating; I can use the ~/ in
client-side paths for
CSS
> > for not for JavaScript files, also it does not
work for IMG tags but
> > does for the server-controls.
> >
> > Oh well.
> >
> > Ben
> >
> > On 12/14/06, Fritts,Jordan <JFritts learn.colostate.edu> wrote:
> > > Ben,
> > >
> > > I know exactly what you're talking about, and
there is any easy
way
> > > around it. I haven't used .NET for some time,
but I just did this
on my
> > > machine.
> > >
> > > Instead of entering "http://localhost/",
just delete the trailing
slash
> > > so you have "http://localhost"
> > >
> > > Thanks,
> > > Jordan
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r) http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
http://discuss.develop.com
> > >
> >
> > ===================================
> > This list is hosted by DevelopMentor(r) http://www.develop.com
> >
> > View archives and manage your subscription(s) at
http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor? http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
|
| VS.NET, Default Web Site, and relative
paths... |

|
2006-12-22 06:10:50 |
If I'm understanding this correctly you could do this either
by launching
the built in webserver pointing to that path via the command
line or there
was a reg file to have a shell extension for "website
here" type
functionality.
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web
[mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Scott Guthrie
Sent: Thursday, December 21, 2006 9:37 AM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] VS.NET, Default Web Site, and
relative paths...
If you want to support absolute paths, for example:
<script
src="/scripts/my.js"></script>
You can use this new feature of VS 2005 SP1 that I blogged
about yesterday:
http://weblogs.asp.net/scottgu/archi
ve/2006/12/19/tip-trick-how-to-run-a-roo
t-site-with-the-local-web-server-using-vs-2005-sp1.aspx
This enables you to
run the built-in VS web-server as a root web-site.
Alternatively, you can convert the web-site from being a
file-system to an
HTTP web-site and run it that way:
http://weblogs.asp.net/scottgu/archive/2005/08/23/4
23409.aspx
Hope this helps,
Scott
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web
[mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Mark Kucera
Sent: Thursday, December 21, 2006 5:51 AM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] VS.NET, Default Web Site, and
relative paths...
The ~/ will work for HTML controls as long as you add
runat="server" to
the control. Usually whenever I add
runat="server" to a control just so
that I can use ~/ then I also make sure to add
EnableViewState="false".
The problem that you'll notice is that this works great for
images and
hyperlinks when used with the traditional <a> or
<img> tags. The method
breaks down in table cells or any control that allows you to
specify
background images. i.e.
<td runat="server"
enableviewstate="false"
background="~/images/background1.gif"></td&g
t;
This example won't work.
There are a couple of other items that won't work by adding
runat="server", notably client side <script>
tags the reference a js
file, because adding runat="server" to a client
side script tag gives
the control a whole new meaning. i.e.
<script language="javascript"
src="~/scripts/my.js"></script>
Also you'll have problems w/ <link> tags that
reference .css style
sheets.
Hopefully this might help you some. At least you won't have
to convert
all your <IMG> to <asp:Image> and <a href>
to <asp:HyperLink> tags...
Good Luck
MK
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web
[mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Ben Joyce
Sent: Thursday, December 21, 2006 6:00 AM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] VS.NET, Default Web Site, and
relative
paths...
I suppose I could use an ASP Server Image control for all my
images,
seems a bit of an overkill though.
On 12/21/06, Ryan Heath <ryan.q.heath gmail.com> wrote:
> In web pages/controls code, you can use
ResolveUrl("~/yourpath") too.
>
> HTH
> // Ryan
>
> On 12/21/06, Ben Joyce <ben.joyce gmail.com> wrote:
> > Hi all. Thanks for the replies, I trawled through
my application
> > making all the required changes.
> >
> > It's a bit frustrating; I can use the ~/ in
client-side paths for
CSS
> > for not for JavaScript files, also it does not
work for IMG tags but
> > does for the server-controls.
> >
> > Oh well.
> >
> > Ben
> >
> > On 12/14/06, Fritts,Jordan <JFritts learn.colostate.edu> wrote:
> > > Ben,
> > >
> > > I know exactly what you're talking about, and
there is any easy
way
> > > around it. I haven't used .NET for some time,
but I just did this
on my
> > > machine.
> > >
> > > Instead of entering "http://localhost/",
just delete the trailing
slash
> > > so you have "http://localhost"
> > >
> > > Thanks,
> > > Jordan
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(r) http://www.develop.com
> > >
> > > View archives and manage your subscription(s)
at
http://discuss.develop.com
> > >
> >
> > ===================================
> > This list is hosted by DevelopMentor(r) http://www.develop.com
> >
> > View archives and manage your subscription(s) at
http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at
http://discuss.develop.com
===================================
This list is hosted by DevelopMentor? http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentor. http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
|
[1-3]
|
|