asp.net newbie question - css href path -
when start debug mode of asp.net website, renders in browser url
http://localhost:111/mywebsite/default.aspx the css file referenced in html
<link href="~/css/style.css" runat="server" rel="stylesheet" type="text/css" /> so naturally site breaks because looks css file in localhost:111/css/ instead of localhost:111/mywebsite/css/.
when launch website, served url:
http://mywebsite.com so there way reference stylesheet in both dev , production area simple prefix <?=$site_url ?> or something?
additional info
in solution explorer, see project marked path c:\...\mywebsite. why ~ assumes project in subdirectory? how tell visual studios project should served http://localhost:111/default.aspx?
this see in page source of both localhost , production server: <link href="~/css/style.css" rel="stylesheet" type="text/css"></link>. css active on production, not localhost.
i went solution explorer, selected item in tree labelled c:\...\mywebsite, went properties window @ bottom right of vs, , changed virtual path /. dev website's root same prod website's root.
Comments
Post a Comment