0

Paths defined within master files are not working on a new server. They worked fine on production server and development machine. Here is an example of the file:

/HeadOffice/Styles/HeadOfficeCalendar.css

Unless I put full URL with the virtual name, the paths don't work.

working:

https://connect.server.co.uk/FesQA/HeadOffice/Styles/HeadOfficeCalendar.css

I can also include resolved URL within ASP>NET code tags but I don't want to change all those paths they are probably hundreds of them. so if the head office folder is in the same folder as master file it should just be able to reference like:

/HeadOffice/Styles/HeadOfficeCalendar.css It seems the references within the master files and aspx files seems to work fine by adding ~ and runat = server. but images references within the CSS files are not working unless I include the full path.

DOESN'T WORK

url(/HeadOffice/Images/tlcorner.png)

DOES WORK

url(connect.server.co.uk/FesQA/HeadOffice/Images/tlcorner.png)
pnuts
  • 58,317
  • 11
  • 87
  • 139
Hakan Zim
  • 305
  • 1
  • 5
  • 15

1 Answers1

1

I know I've answered this before, but this has been known issue forever in VS.

Simple way to do this correctly is to drag the CSS file from Solution Explorer window to head section of master page in code view.

For other links on your site, make sure to include the runat="server" attribute and resolve your links like this (with "~" operator):

<img src="~/images/sample.jpg" runat="server" />
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • doesnt work, unless i include the full URL – Hakan Zim Aug 04 '14 at 16:03
  • Hi, it seems the references within the master files and aspx files seems to work fine by adding ~ and runat = server. but images references within the css files are not working unless i include the full path. DOESN'T WORK --- url(/HeadOffice/Images/tlcorner.png)------- DOES WORK ----- url(https://connect.server.co.uk/FesQA/HeadOffice/Images/tlcorner.png) – Hakan Zim Aug 05 '14 at 10:10
  • Add the links to the question so I can see them? – IrishChieftain Aug 05 '14 at 13:21
  • It depend on your directory structure. Try experimenting with the paths. Check this: http://stackoverflow.com/questions/940451/using-relative-url-in-css-file-what-location-is-it-relative-to – IrishChieftain Aug 05 '14 at 15:01