dummy beginer's question

L

Lloyd Dupont

I'm creating a new web site with a master page.
Imy master page is using a stylesheet
Now the problem is: what if I don't want all page in the same directory but
have some kind of hierarchy, like
www.domain.net/webapp/home.aspx
.....
www.domain.net/webapp/forum/default.aspx
and so on....

The problem is, in my MaterPage I write:
<link rel="stylesheet" type="text/css" href="cookweb.css" />

but this is valid only in the 'wepbapp' folder.
I though I could use '/cookweb.css' but while it will work on my webserver
it won't work while I'm develping...
How could I do that?!?
 
C

clintonG

I think the most common way to resolve this is by using a base class all
content pages inherit from. In the base class you use the ServerVariables
collection to get path info and write that path info and css filename into
an instance of the link element. THis can be done using the new Page.Header
property [1].

<%= Clinton Gallagher
http://clintongallagher.metromilwaukee.com/

[1] google: Page.Header site:msdn2.microsoft.com
 
L

Lloyd Dupont

hum, hum..
I will think on that....

clintonG said:
I think the most common way to resolve this is by using a base class all
content pages inherit from. In the base class you use the ServerVariables
collection to get path info and write that path info and css filename into
an instance of the link element. THis can be done using the new Page.Header
property [1].

<%= Clinton Gallagher
http://clintongallagher.metromilwaukee.com/

[1] google: Page.Header site:msdn2.microsoft.com


Lloyd Dupont said:
I'm creating a new web site with a master page.
Imy master page is using a stylesheet
Now the problem is: what if I don't want all page in the same directory
but have some kind of hierarchy, like
www.domain.net/webapp/home.aspx
....
www.domain.net/webapp/forum/default.aspx
and so on....

The problem is, in my MaterPage I write:
<link rel="stylesheet" type="text/css" href="cookweb.css" />

but this is valid only in the 'wepbapp' folder.
I though I could use '/cookweb.css' but while it will work on my
webserver it won't work while I'm develping...
How could I do that?!?
 
C

clintonG

This article [1] could prove helpful as will the MapPath property.

<%= Clinton Gallagher

[1] http://west-wind.com/weblog/posts/269.aspx


Lloyd Dupont said:
hum, hum..
I will think on that....

clintonG said:
I think the most common way to resolve this is by using a base class all
content pages inherit from. In the base class you use the ServerVariables
collection to get path info and write that path info and css filename into
an instance of the link element. THis can be done using the new
Page.Header property [1].

<%= Clinton Gallagher
http://clintongallagher.metromilwaukee.com/

[1] google: Page.Header site:msdn2.microsoft.com


Lloyd Dupont said:
I'm creating a new web site with a master page.
Imy master page is using a stylesheet
Now the problem is: what if I don't want all page in the same directory
but have some kind of hierarchy, like
www.domain.net/webapp/home.aspx
....
www.domain.net/webapp/forum/default.aspx
and so on....

The problem is, in my MaterPage I write:
<link rel="stylesheet" type="text/css" href="cookweb.css" />

but this is valid only in the 'wepbapp' folder.
I though I could use '/cookweb.css' but while it will work on my
webserver it won't work while I'm develping...
How could I do that?!?
 
C

clintonG

That should have been MapPath method [1] -- not -- property

<%= Clinton Gallagher

[1] mappath site:msdn2.microsoft.com

Lloyd Dupont said:
hum, hum..
I will think on that....

clintonG said:
I think the most common way to resolve this is by using a base class all
content pages inherit from. In the base class you use the ServerVariables
collection to get path info and write that path info and css filename into
an instance of the link element. THis can be done using the new
Page.Header property [1].

<%= Clinton Gallagher
http://clintongallagher.metromilwaukee.com/

[1] google: Page.Header site:msdn2.microsoft.com


Lloyd Dupont said:
I'm creating a new web site with a master page.
Imy master page is using a stylesheet
Now the problem is: what if I don't want all page in the same directory
but have some kind of hierarchy, like
www.domain.net/webapp/home.aspx
....
www.domain.net/webapp/forum/default.aspx
and so on....

The problem is, in my MaterPage I write:
<link rel="stylesheet" type="text/css" href="cookweb.css" />

but this is valid only in the 'wepbapp' folder.
I though I could use '/cookweb.css' but while it will work on my
webserver it won't work while I'm develping...
How could I do that?!?
 
L

Lloyd Dupont

I'll look at it! (when I'll get home).

Anyway I used that:
<link rel="stylesheet" type="text/css" href="~/cookweb.css" />
the trick is the "~/" and the runat=server head section.
And it works beautifully.


clintonG said:
This article [1] could prove helpful as will the MapPath property.

<%= Clinton Gallagher

[1] http://west-wind.com/weblog/posts/269.aspx


Lloyd Dupont said:
hum, hum..
I will think on that....

clintonG said:
I think the most common way to resolve this is by using a base class all
content pages inherit from. In the base class you use the ServerVariables
collection to get path info and write that path info and css filename
into an instance of the link element. THis can be done using the new
Page.Header property [1].

<%= Clinton Gallagher
http://clintongallagher.metromilwaukee.com/

[1] google: Page.Header site:msdn2.microsoft.com


I'm creating a new web site with a master page.
Imy master page is using a stylesheet
Now the problem is: what if I don't want all page in the same directory
but have some kind of hierarchy, like
www.domain.net/webapp/home.aspx
....
www.domain.net/webapp/forum/default.aspx
and so on....

The problem is, in my MaterPage I write:
<link rel="stylesheet" type="text/css" href="cookweb.css" />

but this is valid only in the 'wepbapp' folder.
I though I could use '/cookweb.css' but while it will work on my
webserver it won't work while I'm develping...
How could I do that?!?
 
C

clintonG

Good news. Some of my other suggestions were not even pertinent.

<%= Clinton Gallagher

Lloyd Dupont said:
I'll look at it! (when I'll get home).

Anyway I used that:
<link rel="stylesheet" type="text/css" href="~/cookweb.css" />
the trick is the "~/" and the runat=server head section.
And it works beautifully.


clintonG said:
This article [1] could prove helpful as will the MapPath property.

<%= Clinton Gallagher

[1] http://west-wind.com/weblog/posts/269.aspx


Lloyd Dupont said:
hum, hum..
I will think on that....

message I think the most common way to resolve this is by using a base class all
content pages inherit from. In the base class you use the
ServerVariables collection to get path info and write that path info and
css filename into an instance of the link element. THis can be done
using the new Page.Header property [1].

<%= Clinton Gallagher
http://clintongallagher.metromilwaukee.com/

[1] google: Page.Header site:msdn2.microsoft.com


I'm creating a new web site with a master page.
Imy master page is using a stylesheet
Now the problem is: what if I don't want all page in the same
directory but have some kind of hierarchy, like
www.domain.net/webapp/home.aspx
....
www.domain.net/webapp/forum/default.aspx
and so on....

The problem is, in my MaterPage I write:
<link rel="stylesheet" type="text/css" href="cookweb.css" />

but this is valid only in the 'wepbapp' folder.
I though I could use '/cookweb.css' but while it will work on my
webserver it won't work while I'm develping...
How could I do that?!?
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top