Few minutes ago a colleague and friend asked me about some problem he was having with ASP.NET themes. He was using a theme and including a CSS file in it, the CSS file was linked in the generated HTML but clearly it was not applied. Putting the URL of the CSS file in the browser address bar would return an empty result in Firefox, and a crappy DOCTYPE,HTML,HEAD,BODY tags in IE. The same website works normally with other developers running Windows XP or Windows 7.

Going further to the problem, I tried checking the file access, giving extra permissions and so on, checking web.config and global.asax for any ASP.NET HTTP Handler or HTTP Module that might be handling all requests. None of this existed. Then, I switched to IIS, trying to change the website from custom Application Pool to default integrated pipeline one to default classic (IIS 6 like) one, but no use.

Now I started thinking, images in the website didn’t show also! I didn’t know whether this was a DB/code issue or related to not showing the CSS, well, maybe something is wrong with IIS installation, right? Well, exactly!!!

 

Here’s what the problem was:
Capture

Having installed IIS 7.5 for the first time, the guy thought he just needed to choose ASP.NET features in WWW, he never realized he has to have “Static Content” checked as well. It was really funny when discovered!

Wouldn’t you agree?

Now that we're done, click this out ;)

, , ,
  • http://google.com Shoommigh

    Hi People
    How are you doing?

  • http://
  • http://weblogs.asp.net/meligy Mohamed Meligy

    Yeah, it happens a lot! This is the ugly side of being on a popular host like ASP.NET :s

  • romb

    Thanks ;) saved lots time for me

  • Ezequiel

    Great! that’s because when you click the parent item “Common HTTP Features” the item “Static Content” isn’t checked as default.

  • Lorenzo Peña

    Ey thanks for the tip. I spent like 1 hr trying to find out what was wrong with the setup of my application. This post made the deal.

    =)

  • KaL

    There goes something even more funny: I already did this and only one site don’t show CSS…

  • http://www.cbrxx.com/members/-motorguy.html blackbird rider

    i just wanna thank you for sharing your this information and your site or blog this is simple but nice article I’ve ever seen i like it i learn something new today

  • http://www.unitedpractices.com Paul Connolly

    Me too, I was into hour 3 when I got to this post, ow all is good, thanks a lot!

  • http://www.ermanakkaya.net Erman Akkaya

    Thank you, usefull information.

  • http://www.sepidweb.ir paiman roointan

    really funny! this happened to me too.

  • http://myprjweb.com Mehdi

    Thanks a lot. i have this problem too. but with this tip solved problem. very great

  • Frank

    Thank you for this post

  • Chris Valdivia

    After 10 hours of flailing, I found this article. THANK YOU THANK YOU THANK YOU!!!

    – Chris

  • Nadal

    Still unable to view any css or images though the static content has been selected. On Windows 7 and IIS 7.5. Anyone has other suggestions?

    • Erik

      The other issue that can cause this, depending on your application, is if integrated pipeline mode is used instead of classic. If you have items requiring integrated, you can set them in your handlers with preCondition=”integratedMode”

  • Martijn

    Thnx, what a worthless manner to enable css (and javascript ?) Anyway, thnx for this post! It saved me a lot of time

  • Sdim

    100 recompilations, settings change, etc…

    10 hours lost trying to find the problem…

    One post to correct it!

    Thanks for the solution!

  • Sdim

    100 recompilations, settings change, etc…

    10 hours lost trying to find the problem…

    One post to correct it!

    Thanks for the solution!

  • Ali

    Ali

    hi
    thanks
    In my case this solution work perfectly

  • Rfc1459

    Thank you soooo much for this one! :D I’ve been trying to figure this one out for hours now. :S

  • Srikanth Portal

    Great..Its working now after this fix…

  • http://twitter.com/chriswithpants Chris Gilbert

    Just saved me a whole heap of time – thanks.

  • Guest

    Excellent. This fixed my css issue.

  • Emdad

    thanks. it solved my problem

  • Amine

    Thank you guy,
    I also lost 2 days seeking for the solution … thanks again…

  • Douglas McGregor

    I’m having this problem with all programming languages using IIS. All IIS features are checked, including Static Content. I’m a bit stuck on this just now.

  • Douglas McGregor

    Actually I’ve just solved my own problem. I had to put the full URL in the src bit, e.g.

  • Chris Craft

    THANK YOU!

  • Cdavis

    Awesome, thanks for the fix!

  • Anon

    beautiful, you’ve just saved me the last of my hair ;-)

  • Kamranp

    hi,

    i just made an application in IIS 7.5 localhost/clientrc but no images or css is applied. i followed this article but my static content was checked. website does not show images or any css. as for my windows 7 laptop it shows perfectly fine. any idea?

    thanks

  • dcline97

    I had this exact problem – you saved my bacon – great work!

  • Anonymous

    Great advice. Thanks a lot !!

  • Blabla

    Thanks..

  • paul york

    I’ve been googling and googling for a solution to a problem for a couple of days now (IIS not serving xml files) until I stumbled upon your site! Thanks for the insight – static content is now ticked and everything works! it’s a feature that I missed too.

    Best regards,

    Paul.

  • http://www.goodhelpweb.com Goodhelp

    Mohamed – Your analysis here shows you are 1) an excellent “detective” and 2) not afraid to get into the “guts” of a server setup!

    My WordPress site is behaving just fine…except for one thing. The header area is about 20px too far to the left when viewed in a machine using Windows 7 OS. Win XP displays it the way it should be.

    Has Win 7 a different CSS code or has Win XP an inferior CSS code that needs a “hack” for this?

    The URL: bremestatesales.zippykid.it

    Viewed OK on Dell Celeron XP Pro SP3 in browsers IE8, Firefox, Chrome
    Viewed Not OK on Dell Vostro 3350, Win 7 Pro in Browsers IE8, Firefox, Chrome

    Any help would be most appreciated. Thanks! –Greg
    My em: getgoodhelp (at) gmail (dot) com.

  • Dince

    hai … I’m using wamp server and Windows 7 64 bit

    i have a PHP Project which developed in Windows XPWhen i opened it in my PC, using Wamp Server and Windows 7
    the appearence looks totally different.
    the code which linked to css wont show
    do u have any idea why that happens?

    • Dince

      PS: I have checked the Static Content

  • Dince

    hai … I’m using wamp server and Windows 7 64 biti have a PHP Project which developed in Windows XPWhen i opened it in my PC, using Wamp Server and Windows 7
    the appearence looks totally different.
    the code which linked to css wont show
    do u have any idea why that happens?NB: I have checked Static Content i

  • Deepak

    Thank you very much. This worked for me… :)

  • zohaib

    just chk out the location where we publish the file sometimes the files doesnt have both images and css…Simply copy and paste the images and css this for me…here

  • Pingback: Web | Pearltrees

  • Sky

    Thanks It worked for me, I was struggling with it for whole day

  • d

    wow…thank you!

  • vfrissora

    thanks for the post! saved me lots of time.

  • angry

    THANK YOU SPENT THE MORNING PUNCHING MY MONITOR AND THIS WAS THE ISSUE.

  • Alfredo

    Tanks!!

  • taher

    huhu yes it funny problem
    thank you dear
    i solve my proble by checked static

  • Ashraf Ali

    I have already checked the static content but still getting not images in IIS7.Please help

    • kamal

      I am in Windows 8.1 Pro 64 bits with IIS8. I’ve tried all proposed solutions. and still doesnt work…..

      • http://gurustop.net/ @Meligy

        Are you sure it’s not ASP.NET Bundling issue or something? Do you see errors in the console? If you see 404s in the console, double check the URLs to make sure they are correct. Also maybe it’s unauthorized (401) error instead of not found (404).

  • Sandy

    I did try this and it is still not working for me..any more suggestions.