views:

47

answers:

1

I have a small app I've written, and it works well when using the dev server, but as soon as i switch to IIS on my local box (IIS 7), I lose images and styles.

I tried using Url.Content and that kind of works for styles and images in the master page, but I still lose images that are referenced from CSS styles

Is there any way I can get this to work in both the local mode and via localhost/iis?

I suspect this has something to do with virtual directories, but don't know IIS well enough to say for sure.

Thanks.

A: 

Did you publish or upload your images? If you did not add your images into your project, they will not be published.

More questions:

Have you updated any routing rules? If so, please show them to us. Do you declare any authorisation attributes over your controllers?

Syd
Yes, I published them.
SunilK
@Sunil, can you tell us where is your stylesheet and your images? Please upload to here a portion of your css.
Syd
images are in: Content/images/*.gif styles are in: Content/css/style.cssHere is a sample style:div#header{ background-image: url(../../Content/images/header.gif); position:relative; height:47px; margin:0px 0px 15px 0px;}
SunilK
that didnt come out quite right.. but i'm sure you get the idea..
SunilK
I added some more questions. But following up on this, are any of the styles referred in this style sheet appear in the generated output html page?
Syd
I moved style.css to the same level as Site.css. I then checked that I could see Site.css using the browser.. I can. Then I checked style.css, lo and behold, it told me it could not find the file... wierd, both files are there. I'm starting to wonder if I am not fighting a vista permissions problem
SunilK
Hah!! not permissions, the css file was encrypted. which means iis7 cannot dish up encrypted files. Now the css is being seen and the layout is correct. Just the images left.. getting closer :)
SunilK
Bingo! its working. Word of advice to the unsuspecting. Vista might encrypt files on you, and if those files are part of your web app, you'll run into headaches like i did. Everything is working now. Thanks for the help.. it helped me narrow this down.
SunilK
Congrats. Thanks for sharing your answer too :)
Syd