c# – 链接到本地??目录中的图像与URL,我做错了什么?
发布时间:2020-12-15 21:24:58 所属栏目:百科 来源:网络整理
导读:在xaml中如果有以下内容: Setter Property="Source" Value="Image/somehing.png"/ 并使用它来创建一个图像,它工作正常,但如果我这样做,如下所示: Setter Property="Source" Value="AnASPXPage.aspx"/ 我在页面内做: Response.Redirect("Image/somehing.pn
在xaml中如果有以下内容:
<Setter Property="Source" Value="Image/somehing.png"/> 并使用它来创建一个图像,它工作正常,但如果我这样做,如下所示: <Setter Property="Source" Value="AnASPXPage.aspx"/> 我在页面内做: Response.Redirect("Image/somehing.png"); 它不起作用. 但如果我在线链接到图像,即: Response.Redirect("url.com/Image/somehing.png"); 它工作正常. 我怎样才能使它能从aspx页面链接到本地??图像目录? 解决方法
不确定您的目录结构,但路径前面的“?”将解析为应用程序的根目录,无论是根站点还是虚拟目录.
Response.Redirect("~Image/somehing.png"); 要么 Response.Redirect("~/Image/somehing.png"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |