开发者

Error at <img> tag in ASP.NET

开发者 https://www.devze.com 2022-12-22 16:45 出处:网络
I have this code <a href=\"~Home.aspx\"> <img style=\"float:left;m开发者_StackOverflowargin-left:1px;\" src=~img/head/acasa.png

I have this code

<a href="~Home.aspx">
<img style="float:left;m开发者_StackOverflowargin-left:1px;" src=~img/head/acasa.png 
        title="Acasa" />
</a>

and when I start the project , VS returns me this error "Error 38 Cannot use a leading .. to exit above the top directory."

What`s is the problem ??

This code id part of a control *ascx


You need to adjust the src and quote it, and add runat="server" if you want to relatively resolve it to application root:

<img style="float:left;margin-left:1px;" 
     src="~/img/head/acasa.png" title="Acasa" runat="server" />

The same applies for the anchor:

<a href="~/Home.aspx" runat="server">
0

精彩评论

暂无评论...
验证码 换一张
取 消