I just spent the better part of an hour trying to work out why one particular CSS link in an ASP.NET MVC masterpage would not rebase when the others were working perfectly.
Lets see if you can spot the problem?
1: <link href="../../Scripts/style.css"rel="stylesheet" type="text/css" />
Can you see the problem?
I couldn’t for almost an hour and then it struck me, there is no space between my href and rel attributes surely it can’t be that. Yup that was exactly the problem, sticking the space in there made it all work! Sometimes I just *love* development!
So remember, if ASP.NET MVC isn’t rebasing a CSS link in one of your masterpages make sure there is a space between all your link attributes!
1 comment:
Jon,
Uou spent one hour trying to figure out why this was not working? haha.. If you were working in my company, I would have fired you on the spot!
Try this next time:
Physical Location Reference - Server.Mappath("~/default.aspx") - gives c:\inetpub\wwwroot\testsite\default.aspx
WebSite URL Reference - Page.ResolveUrl("~/default.aspx") - gives http://localhost/testsite/default.aspx
Furthermore:
http://msdn.microsoft.com/en-us/library/ms178116.aspx
http://msdn.microsoft.com/en-us/library/ms178116.aspx
Happy Coding!
Post a Comment