Can I combine ASP with external CSS?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Speiss

    Can I combine ASP with external CSS?

    I am trying to display a random background image for a webpage. I found
    this code to do it

    <%
    'Defines the number of background images you have
    Const NUMBER_OF_IMAGE S = 2

    'Initiates the randomize function
    Randomize

    'Sets a variable: this will be used to hold the
    'random generated value
    Dim intImageNumber

    'This is where we create the random number
    intImageNumber = Int((NUMBER_OF_ IMAGES * Rnd) + 1)
    %>


    Modify the body tag to accept the random number. In this case we are going
    to place it within the image so as to facilitate the selection of a random
    image.

    <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif">

    This did work.

    In my case, I have an external style sheet with this defined:

    body {
    color:#333;
    background-color: gray;
    background-image: url(../images/bg_<%=intImageN umber%>.JPG);
    background-attachment: fixed;
    margin:20px;
    padding:0px;
    font:11px verdana, arial, helvetica, sans-serif;
    }

    and it is included in my main page with

    <head>
    <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
    </head>

    which comes after the above randomizing script

    I removed <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif"> from the main
    page and replaced it with just <body> thinking that since it is defined in
    the external CSS file I wouldn't need it on each page.

    I just got a gray background. Since I am really new to ASP and CSS I am not
    sure the variables are global throughout included files or not. I wanted to
    have the background image defined in the style file since it is used
    everywhere so rather than modiying <body> for each page I could have it in
    one place.

    Can this be done this way? Is there a better way to handle this situation?

    Many thanks

    Richard Speiss


  • Evertjan.

    #2
    Re: Can I combine ASP with external CSS?

    Richard Speiss wrote on 08 jun 2004 in
    microsoft.publi c.inetserver.as p.general:
    [color=blue]
    > <head>
    > <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
    > </head>
    >[/color]

    <link type="text/css" href="css/cvs.asp" rel="stylesheet ">

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Roland Hall

      #3
      Re: Can I combine ASP with external CSS?

      "Richard Speiss" wrote in message
      news:%235vLtLaT EHA.3664@TK2MSF TNGP12.phx.gbl. ..
      : I am trying to display a random background image for a webpage. I found
      : this code to do it
      :
      : <%
      : 'Defines the number of background images you have
      : Const NUMBER_OF_IMAGE S = 2
      :
      : 'Initiates the randomize function
      : Randomize
      :
      : 'Sets a variable: this will be used to hold the
      : 'random generated value
      : Dim intImageNumber
      :
      : 'This is where we create the random number
      : intImageNumber = Int((NUMBER_OF_ IMAGES * Rnd) + 1)
      : %>
      :
      :
      : Modify the body tag to accept the random number. In this case we are going
      : to place it within the image so as to facilitate the selection of a random
      : image.
      :
      : <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif">
      :
      : This did work.
      :
      : In my case, I have an external style sheet with this defined:
      :
      : body {
      : color:#333;
      : background-color: gray;
      : background-image: url(../images/bg_<%=intImageN umber%>.JPG);
      : background-attachment: fixed;
      : margin:20px;
      : padding:0px;
      : font:11px verdana, arial, helvetica, sans-serif;
      : }
      :
      : and it is included in my main page with
      :
      : <head>
      : <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
      : </head>
      :
      : which comes after the above randomizing script
      :
      : I removed <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif"> from the main
      : page and replaced it with just <body> thinking that since it is defined in
      : the external CSS file I wouldn't need it on each page.
      :
      : I just got a gray background. Since I am really new to ASP and CSS I am
      not
      : sure the variables are global throughout included files or not. I wanted
      to
      : have the background image defined in the style file since it is used
      : everywhere so rather than modiying <body> for each page I could have it in
      : one place.
      :
      : Can this be done this way? Is there a better way to handle this
      situation?

      Remove the background-image line from your external CSS and just use it in
      an onload.

      <body onload="bg_<%= intImageNumber %>.gif">

      Perhaps if your CSS was linked in prior to the script running and it was
      ..css instead of .asp, then perhaps the ASP processor would process that part
      before rendering the page to the client. As it is now, and you can test by
      loading the cvs.asp by itself and looking at the source, you'll see what is
      actually being returned.

      --
      Roland Hall
      /* This information is distributed in the hope that it will be useful, but
      without any warranty; without even the implied warranty of merchantability
      or fitness for a particular purpose. */
      Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
      WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
      MSDN Library - http://msdn.microsoft.com/library/default.asp


      Comment

      • Richard Speiss

        #4
        Re: Can I combine ASP with external CSS?

        Thanks but that didn't make a difference

        Richard

        "Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
        news:Xns95031B2 9448Feejj99@194 .109.133.29...[color=blue]
        > Richard Speiss wrote on 08 jun 2004 in
        > microsoft.publi c.inetserver.as p.general:
        >[color=green]
        > > <head>
        > > <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
        > > </head>
        > >[/color]
        >
        > <link type="text/css" href="css/cvs.asp" rel="stylesheet ">
        >
        > --
        > Evertjan.
        > The Netherlands.
        > (Please change the x'es to dots in my emailaddress)[/color]


        Comment

        • Richard Speiss

          #5
          Re: Can I combine ASP with external CSS?


          But if I use <body onload ... , then I need to have that piece of code on
          each .asp page which is what I was trying to avoid.

          If I load cvs.asp by itself then it wouldn't have intImageNumber filled in
          since the number is generated by the file that includes it. I guess that's
          my question; whether a value generated in a page can be used by something
          that is included. Your point is good though. Which is done first? Does
          the ASP VB code get executed first or does the style inclusion in the <head>
          section.

          By doing a little test it looks like intImageNumber doesn't make it from
          index.asp to cvs.asp. Or I am still missing something

          Thanks

          Richard
          [color=blue]
          > Remove the background-image line from your external CSS and just use it in
          > an onload.
          >
          > <body onload="bg_<%= intImageNumber %>.gif">
          >
          > Perhaps if your CSS was linked in prior to the script running and it was
          > .css instead of .asp, then perhaps the ASP processor would process that[/color]
          part[color=blue]
          > before rendering the page to the client. As it is now, and you can test[/color]
          by[color=blue]
          > loading the cvs.asp by itself and looking at the source, you'll see what[/color]
          is[color=blue]
          > actually being returned.
          >
          > --
          > Roland Hall
          > /* This information is distributed in the hope that it will be useful, but
          > without any warranty; without even the implied warranty of merchantability
          > or fitness for a particular purpose. */
          > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
          > WSH 5.6 Documentation -[/color]
          http://msdn.microsoft.com/downloads/list/webdev.asp[color=blue]
          > MSDN Library - http://msdn.microsoft.com/library/default.asp
          >
          >[/color]


          Comment

          • Mark Schupp

            #6
            Re: Can I combine ASP with external CSS?

            index.asp and cvs.asp are separate asp scripts so the value of
            intImageNumber will not pass from index to cvs. You will need to include the
            random background code in the cvs.asp file.

            The sequence of execution is:

            index.asp is requested by the browser

            index.asp is executed on the server and the generated html returned to the
            browser. This html will include your style or link tag. Note that at this
            time the cvs.asp script has not been called.

            browser finds the link tag or style import directive in the html and sends a
            request for cvs.asp

            cvs.asp is executed on the server and the resulting text is returned (You
            will probably have to set response.conten ttype to whatever is valid for a
            stylesheet in order for the browser to use the styles).

            --
            Mark Schupp
            Head of Development
            Integrity eLearning
            Advancing limitless knowledge and continual growth to create confident problem solvers, one course at a time.



            "Richard Speiss" <rspeiss@mtxinc .com> wrote in message
            news:uvUUesaTEH A.564@TK2MSFTNG P11.phx.gbl...[color=blue]
            >
            > But if I use <body onload ... , then I need to have that piece of code on
            > each .asp page which is what I was trying to avoid.
            >
            > If I load cvs.asp by itself then it wouldn't have intImageNumber filled in
            > since the number is generated by the file that includes it. I guess that's
            > my question; whether a value generated in a page can be used by something
            > that is included. Your point is good though. Which is done first? Does
            > the ASP VB code get executed first or does the style inclusion in the[/color]
            <head>[color=blue]
            > section.
            >
            > By doing a little test it looks like intImageNumber doesn't make it from
            > index.asp to cvs.asp. Or I am still missing something
            >
            > Thanks
            >
            > Richard
            >[color=green]
            > > Remove the background-image line from your external CSS and just use it[/color][/color]
            in[color=blue][color=green]
            > > an onload.
            > >
            > > <body onload="bg_<%= intImageNumber %>.gif">
            > >
            > > Perhaps if your CSS was linked in prior to the script running and it was
            > > .css instead of .asp, then perhaps the ASP processor would process that[/color]
            > part[color=green]
            > > before rendering the page to the client. As it is now, and you can test[/color]
            > by[color=green]
            > > loading the cvs.asp by itself and looking at the source, you'll see what[/color]
            > is[color=green]
            > > actually being returned.
            > >
            > > --
            > > Roland Hall
            > > /* This information is distributed in the hope that it will be useful,[/color][/color]
            but[color=blue][color=green]
            > > without any warranty; without even the implied warranty of[/color][/color]
            merchantability[color=blue][color=green]
            > > or fitness for a particular purpose. */
            > > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
            > > WSH 5.6 Documentation -[/color]
            > http://msdn.microsoft.com/downloads/list/webdev.asp[color=green]
            > > MSDN Library - http://msdn.microsoft.com/library/default.asp
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Lance Wynn

              #7
              Re: Can I combine ASP with external CSS?

              You can map css pages to be processed through the same engine as the ASP
              pages. Then you can just embed your ASP code in the CSS file.



              "Richard Speiss" <rspeiss@mtxinc .com> wrote in message
              news:%235vLtLaT EHA.3664@TK2MSF TNGP12.phx.gbl. ..
              I am trying to display a random background image for a webpage. I found
              this code to do it

              <%
              'Defines the number of background images you have
              Const NUMBER_OF_IMAGE S = 2

              'Initiates the randomize function
              Randomize

              'Sets a variable: this will be used to hold the
              'random generated value
              Dim intImageNumber

              'This is where we create the random number
              intImageNumber = Int((NUMBER_OF_ IMAGES * Rnd) + 1)
              %>


              Modify the body tag to accept the random number. In this case we are going
              to place it within the image so as to facilitate the selection of a random
              image.

              <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif">

              This did work.

              In my case, I have an external style sheet with this defined:

              body {
              color:#333;
              background-color: gray;
              background-image: url(../images/bg_<%=intImageN umber%>.JPG);
              background-attachment: fixed;
              margin:20px;
              padding:0px;
              font:11px verdana, arial, helvetica, sans-serif;
              }

              and it is included in my main page with

              <head>
              <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
              </head>

              which comes after the above randomizing script

              I removed <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif"> from the main
              page and replaced it with just <body> thinking that since it is defined in
              the external CSS file I wouldn't need it on each page.

              I just got a gray background. Since I am really new to ASP and CSS I am not
              sure the variables are global throughout included files or not. I wanted to
              have the background image defined in the style file since it is used
              everywhere so rather than modiying <body> for each page I could have it in
              one place.

              Can this be done this way? Is there a better way to handle this situation?

              Many thanks

              Richard Speiss



              Comment

              • Richard Speiss

                #8
                Re: Can I combine ASP with external CSS?

                Oh that was way too easy. I wasn't thinking that I could actually execute
                the VB script inside a style file since it was just declarations but when I
                think about it, it does make sense.

                Thanks a lot. It's working great now

                RIchard

                "Lance Wynn" <lance_wynn@N.O .S.P.A.M.hotmai l.com> wrote in message
                news:u8tCWqbTEH A.2324@TK2MSFTN GP10.phx.gbl...[color=blue]
                > You can map css pages to be processed through the same engine as the ASP
                > pages. Then you can just embed your ASP code in the CSS file.
                >
                >
                >
                > "Richard Speiss" <rspeiss@mtxinc .com> wrote in message
                > news:%235vLtLaT EHA.3664@TK2MSF TNGP12.phx.gbl. ..
                > I am trying to display a random background image for a webpage. I found
                > this code to do it
                >
                > <%
                > 'Defines the number of background images you have
                > Const NUMBER_OF_IMAGE S = 2
                >
                > 'Initiates the randomize function
                > Randomize
                >
                > 'Sets a variable: this will be used to hold the
                > 'random generated value
                > Dim intImageNumber
                >
                > 'This is where we create the random number
                > intImageNumber = Int((NUMBER_OF_ IMAGES * Rnd) + 1)
                > %>
                >
                >
                > Modify the body tag to accept the random number. In this case we are going
                > to place it within the image so as to facilitate the selection of a random
                > image.
                >
                > <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif">
                >
                > This did work.
                >
                > In my case, I have an external style sheet with this defined:
                >
                > body {
                > color:#333;
                > background-color: gray;
                > background-image: url(../images/bg_<%=intImageN umber%>.JPG);
                > background-attachment: fixed;
                > margin:20px;
                > padding:0px;
                > font:11px verdana, arial, helvetica, sans-serif;
                > }
                >
                > and it is included in my main page with
                >
                > <head>
                > <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
                > </head>
                >
                > which comes after the above randomizing script
                >
                > I removed <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif"> from the main
                > page and replaced it with just <body> thinking that since it is defined in
                > the external CSS file I wouldn't need it on each page.
                >
                > I just got a gray background. Since I am really new to ASP and CSS I am[/color]
                not[color=blue]
                > sure the variables are global throughout included files or not. I wanted[/color]
                to[color=blue]
                > have the background image defined in the style file since it is used
                > everywhere so rather than modiying <body> for each page I could have it in
                > one place.
                >
                > Can this be done this way? Is there a better way to handle this[/color]
                situation?[color=blue]
                >
                > Many thanks
                >
                > Richard Speiss
                >
                >
                >[/color]


                Comment

                • Aaron [SQL Server MVP]

                  #9
                  Re: Can I combine ASP with external CSS?

                  No, you can't do that, because the CSS file is not included in the
                  server-side script, it is only sent to the client-side browser for parsing.

                  You can use a CSS file as ASP:

                  body {
                  ....
                  background-image: url(../images/bg_<%=Request.Q ueryString("i") %>.jpg);
                  ....
                  }

                  Then call it like this:

                  <link rel=stylesheet href=css.asp?i= <%=intImageNumb er%>>

                  Or, you can just put the style inline instead of a linked file.

                  You lose the benefit of using an external style sheet by making the content
                  dynamic, but you can keep the same maintenance benefit by using an external
                  ASP file.

                  --

                  (Reverse address to reply.)





                  "Richard Speiss" <rspeiss@mtxinc .com> wrote in message
                  news:%235vLtLaT EHA.3664@TK2MSF TNGP12.phx.gbl. ..[color=blue]
                  >I am trying to display a random background image for a webpage. I found
                  > this code to do it
                  >
                  > <%
                  > 'Defines the number of background images you have
                  > Const NUMBER_OF_IMAGE S = 2
                  >
                  > 'Initiates the randomize function
                  > Randomize
                  >
                  > 'Sets a variable: this will be used to hold the
                  > 'random generated value
                  > Dim intImageNumber
                  >
                  > 'This is where we create the random number
                  > intImageNumber = Int((NUMBER_OF_ IMAGES * Rnd) + 1)
                  > %>
                  >
                  >
                  > Modify the body tag to accept the random number. In this case we are going
                  > to place it within the image so as to facilitate the selection of a random
                  > image.
                  >
                  > <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif">
                  >
                  > This did work.
                  >
                  > In my case, I have an external style sheet with this defined:
                  >
                  > body {
                  > color:#333;
                  > background-color: gray;
                  > background-image: url(../images/bg_<%=intImageN umber%>.JPG);
                  > background-attachment: fixed;
                  > margin:20px;
                  > padding:0px;
                  > font:11px verdana, arial, helvetica, sans-serif;
                  > }
                  >
                  > and it is included in my main page with
                  >
                  > <head>
                  > <style type="text/css" media="screen"> @import "css/cvs.asp";</style>
                  > </head>
                  >
                  > which comes after the above randomizing script
                  >
                  > I removed <BODY BACKGROUND="bg_ <%= intImageNumber %>.gif"> from the main
                  > page and replaced it with just <body> thinking that since it is defined in
                  > the external CSS file I wouldn't need it on each page.
                  >
                  > I just got a gray background. Since I am really new to ASP and CSS I am
                  > not
                  > sure the variables are global throughout included files or not. I wanted
                  > to
                  > have the background image defined in the style file since it is used
                  > everywhere so rather than modiying <body> for each page I could have it in
                  > one place.
                  >
                  > Can this be done this way? Is there a better way to handle this
                  > situation?
                  >
                  > Many thanks
                  >
                  > Richard Speiss
                  >
                  >[/color]


                  Comment

                  • Aaron [SQL Server MVP]

                    #10
                    Re: Can I combine ASP with external CSS?

                    > Oh that was way too easy.

                    Yes, and you know what they say when a solution is very easy: it probably
                    isn't the best solution. If you're using a version of IIS prior to 6.0,
                    this "easy" solution is going to cost you dearly, because every single CSS
                    file your site serves will be parsed by the ASP engine (and again, there go
                    the benefits of re-using a linked CSS file).

                    A


                    Comment

                    • Richard Speiss

                      #11
                      Re: Can I combine ASP with external CSS?

                      I also just found out that although this worked great for IE and Opera.
                      Netscape and Firefox didn't see any of the CSS at all. The only way I got
                      it to work for them was to change the extension of the css file from ASP
                      which eliminated having the ASP part of the CSS file. 6 of one and half
                      dozen of another.

                      I see you have another post here explaining things in more detail. I guess
                      I will have to do some more reading

                      Thanks for your input

                      Richard

                      "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
                      news:%230Sg2vcT EHA.2416@TK2MSF TNGP09.phx.gbl. ..[color=blue][color=green]
                      > > Oh that was way too easy.[/color]
                      >
                      > Yes, and you know what they say when a solution is very easy: it probably
                      > isn't the best solution. If you're using a version of IIS prior to 6.0,
                      > this "easy" solution is going to cost you dearly, because every single CSS
                      > file your site serves will be parsed by the ASP engine (and again, there[/color]
                      go[color=blue]
                      > the benefits of re-using a linked CSS file).
                      >
                      > A
                      >
                      >[/color]


                      Comment

                      • Aaron [SQL Server MVP]

                        #12
                        Re: Can I combine ASP with external CSS?

                        Yes, that's right... perhaps you might have to avoid using server-side code
                        for Firefox, since IIRC it will only accept CSS extension as CSS. Anything
                        else that contains style information will be ignored. So, let firefox users
                        see a single static image. Or, like my other suggestion, keep those styles
                        that must be dynamic in an inline <style> block (e.g. in an include).

                        Another idea might be to have background-image:url(somef ile.asp);

                        Then have somefile.asp stream a randomly-selected image.

                        --

                        (Reverse address to reply.)




                        "Richard Speiss" <rspeiss@hotmai l.com> wrote in message
                        news:%23fB4P1cT EHA.384@TK2MSFT NGP10.phx.gbl.. .[color=blue]
                        >I also just found out that although this worked great for IE and Opera.
                        > Netscape and Firefox didn't see any of the CSS at all. The only way I got
                        > it to work for them was to change the extension of the css file from ASP
                        > which eliminated having the ASP part of the CSS file. 6 of one and half
                        > dozen of another.
                        >
                        > I see you have another post here explaining things in more detail. I
                        > guess
                        > I will have to do some more reading
                        >
                        > Thanks for your input
                        >
                        > Richard[/color]


                        Comment

                        • Lance Wynn

                          #13
                          Re: Can I combine ASP with external CSS?

                          This isn't really That big of a problem, because most browsers will cache
                          the css file, and therefore won't request it each time. Even if the request
                          is made each time a page is loaded, the cost of parsing a file through the
                          ASP engine likely isn't going to affect performance all that much anyway,
                          most IIS servers will be able to outperform your internet connection anyway
                          (Unless you are doing some heavy Database access, or something), however if
                          it's just an if then else, or case statement you are processing; I doubt
                          that you'll notice a performance hit at all.

                          I think "cost you dearly" may be a bit strong. After all, the ASP engine is
                          there to create dynamic pages, whether they have an extension of .ASP, .HTM,
                          ..CSS, whatever; I say go ahead and use it.

                          Also, you can map .CSS files to run through the ASP engine within the IIS
                          Management console. just click the configuration button next to the
                          application. That way you won't have to call the .CSS file a .ASP file.

                          Lance



                          "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
                          news:%230Sg2vcT EHA.2416@TK2MSF TNGP09.phx.gbl. ..[color=blue]
                          > Oh that was way too easy.[/color]

                          Yes, and you know what they say when a solution is very easy: it probably
                          isn't the best solution. If you're using a version of IIS prior to 6.0,
                          this "easy" solution is going to cost you dearly, because every single CSS
                          file your site serves will be parsed by the ASP engine (and again, there go
                          the benefits of re-using a linked CSS file).

                          A



                          Comment

                          • Aaron [SQL Server MVP]

                            #14
                            Re: Can I combine ASP with external CSS?

                            > This isn't really That big of a problem, because most browsers will cache[color=blue]
                            > the css file, and therefore won't request it each time.[/color]

                            If the CSS file is dynamic like ASP, then there will be no difference
                            between requesting an ASP file and requesting a CSS file. Even if what you
                            said were true, then doesn't that defeat the purpose of injecting a random
                            background image? So how does that suggestion help achieve the goal?
                            [color=blue]
                            > I think "cost you dearly" may be a bit strong. After all, the ASP engine[/color]
                            is[color=blue]
                            > there to create dynamic pages, whether they have an extension of .ASP,[/color]
                            ..HTM,[color=blue]
                            > .CSS, whatever; I say go ahead and use it.[/color]

                            Uh, the ASP engine is not used to process HTM and CSS files unless you tell
                            it to. And if you tell it to process all CSS files as ASP files, then the
                            ASP engine will be invoked for all CSS files. Regardless of whether or not
                            they contain any dynamic code; and regardless of whether or not they were
                            called from an ASP file. So if you're calling a CSS file from an ASP file,
                            the "extra" cost might not be that much. But if you have a lot of static
                            HTML pages that use CSS files, those HTML pages suddenly take significant
                            resources to render.

                            Go ahead and map all your CSS files to asp.dll if you like. But I don't
                            think it's very good advice for people who are trying to get decent
                            performance out of their servers.

                            A


                            Comment

                            • Lance Wynn

                              #15
                              Re: Can I combine ASP with external CSS?

                              This is true, by default, HTML files, and CSS files aren't processed by the
                              ASP engine, and in most cases they don't need to be, but there are, in some
                              cases, definite advantages to allowing the ASP engine to process the CSS
                              files. I'm not, nor did I ever say this is true in all cases, but it is
                              certainly worth looking into as a viable option.

                              In fact, you raise a very interesting point. There may be certain cases
                              where there are static HTML pages, that you want to receive Dynamic Styles
                              depending on a customer, or a specific situation. In this case, I think
                              processing the CSS through the ASP engine would be a correct way to go. The
                              HTML file won't go through the ASP engine, but the CSS will.

                              Another thing you need to look at is, how many css style sheets do you have
                              in your site, and of those how many do you want to be able to dynamically
                              modify? If you have a limited number of style sheets, or if you decide you
                              want all the style sheets to be able to return dynamic content, then why not
                              map them to the ASP engine? If you only have 1 out of 50 CSS files that
                              need dynamic content, I agree with Aaron running all of them through the ASP
                              engine is probably wasteful.

                              In the end, it's up to you how you do it. The ASP designers put the
                              functionally in there to use, and if it fits the bill, I say use it (if it
                              fits the requirement).



                              "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
                              news:OfXMwkjTEH A.2336@TK2MSFTN GP10.phx.gbl...[color=blue]
                              > This isn't really That big of a problem, because most browsers will cache
                              > the css file, and therefore won't request it each time.[/color]

                              If the CSS file is dynamic like ASP, then there will be no difference
                              between requesting an ASP file and requesting a CSS file. Even if what you
                              said were true, then doesn't that defeat the purpose of injecting a random
                              background image? So how does that suggestion help achieve the goal?
                              [color=blue]
                              > I think "cost you dearly" may be a bit strong. After all, the ASP engine[/color]
                              is[color=blue]
                              > there to create dynamic pages, whether they have an extension of .ASP,[/color]
                              ..HTM,[color=blue]
                              > .CSS, whatever; I say go ahead and use it.[/color]

                              Uh, the ASP engine is not used to process HTM and CSS files unless you tell
                              it to. And if you tell it to process all CSS files as ASP files, then the
                              ASP engine will be invoked for all CSS files. Regardless of whether or not
                              they contain any dynamic code; and regardless of whether or not they were
                              called from an ASP file. So if you're calling a CSS file from an ASP file,
                              the "extra" cost might not be that much. But if you have a lot of static
                              HTML pages that use CSS files, those HTML pages suddenly take significant
                              resources to render.

                              Go ahead and map all your CSS files to asp.dll if you like. But I don't
                              think it's very good advice for people who are trying to get decent
                              performance out of their servers.

                              A



                              Comment

                              Working...