« Previous Next »

Thread: Default Document not showing CSS

Last post 06-11-2009 1:53 PM by anilr. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 06-11-2009, 6:58 AM

    • BullionZA
    • Not Ranked
    • Joined on 06-11-2009, 10:46 AM
    • Posts 1

    Default Document not showing CSS

    Hi all...

     

    I am new to IIS 7.0 and can not understand why when my ASP.Net web site is published to the web server, using IIS 7.0, the default document specified in the web.config file is shown without any of the style set up in the CSS file.

     I have a sub directory under my main web site directory called webforms where the default document is located. I have another sub directory under the main web site directory called stylesheets where the css files are located.

     If I browse to the actual file in its sub directory, the CSS is shown just fine. I dont understand why the "default document" does not show the CSS although in essence it is the exact same file.

    If i change the default document in the web.config to a file under the main directory (and not in a sub directory), the CSS is displayed just fine.

     

    File structure is as follows:

    -WEBSITE

    ---------stylesheets

    -------------------- stylsheet.css

    ---------webforms

    --------------------defaultpage.aspx

  • 06-11-2009, 8:23 AM In reply to

    Re: Default Document not showing CSS

    BullionZA:

     If I browse to the actual file in its sub directory, the CSS is shown just fine. I dont understand why the "default document" does not show the CSS although in essence it is the exact same file.

    If i change the default document in the web.config to a file under the main directory (and not in a sub directory), the CSS is displayed just fine.

    Sounds like a classic error of relative file links pointing to the wrong folder.

    Jeff

    Look for Wrox's new book Professional IIS 7 in your local bookstore, or order now at Amazon.com
  • 06-11-2009, 1:53 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,247

    Re: Default Document not showing CSS

    Note that the browser does not know that the your default document is in a subdirectory - so if you are using relative links to your css, it would have to be stylesheets/stylesheet.css (and not ../stylesheet/stylesheet.css)

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (3 items)