For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > January 2008 > a problem with ~/









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author a problem with ~/
Tahir

2008-01-17, 8:15 am

hi,

here is some code from my MasterPage:
......
<body>
<form id="form1" runat="server">

<div id="main-header" class="box">
<img src="Tema/banner.bmp" alt=""/>
......

i have a "Tema" folder at root directory containing MasterPage and
banner.bmp.
* when i use this code, VS indicates that banner file is missing but at
debug time web browser shows the image, the result is ok.
* when i write there ="~/Tema/banner.bmp", VS says ok but browser says image
missing where it shows the address "localhost/website/~/Tema/banner.bmp"
* when i show the image by vs gui, the code apperas as
src="../Tema/banner.bmp", image is still missing and browser shows the
address "localhost/Tema/banner.bmp"

can anybody who understands the "~" operator, describes this?


"Lance Wynn" <Lance_Wynn@community.nospam>, iletisinde şunu yazdı,
news:OSukvYLWIHA.4904@TK2MSFTNGP06.phx.gbl...
> Hello all,
> Is there a way to use the ~/ path to link a CSS page?
>
> I thought maybe something like this would work, but no go:
> <link href="~/style.css" rel="stylesheet" type="text/css"/>
>
> Is this possible to do with the link element?
>
> Thanks
>


Mark Rae [MVP]

2008-01-17, 8:15 am

"Tahir" <kurkcutahir@gmail.com> wrote in message
news:etClQWQWIHA.4712@TK2MSFTNGP04.phx.gbl...

> can anybody who understands the "~" operator, describes this?


The tilde (~) is server-side notation, not client-side notation...

That is why something like: <img src="~/Tema/banner.bmp" alt=""/> can never
work...

However, <img src="~/Tema/banner.bmp" alt="" runat="server" /> will work...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com