设置Absolute ImageUrl [英] Setting Absolute ImageUrl

查看:171
本文介绍了设置Absolute ImageUrl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.aspx页面上有一个Image控件,我想将ImageUrl设置为这样:

I have an Image control on my .aspx page and I want to set the ImageUrl to something like this:

<asp:Image ID="imgLogo" ImageUrl="C:\ExternalImages\logo.jpg" runat="server" />

但这不起作用。我在MSDN上阅读了有关ImageUrl属性的内容,并说它可以是绝对路径或相对路径。但是我如何设置如上所示的完整路径?

But this doesn't work. I read about the ImageUrl property on MSDN and it says that the url could have either be an absolute or relative path. But how can i set the complete path like shown above?

推荐答案

通过绝对URL,它们表示URL的整个IIS路径(不是您的磁盘目录路径)。 (即 http://yourVirtualDirectory/ExternalImages/logo.jpg )。

By absolute url, they mean the entire IIS path to the URL (Not your disk directory path). (i.e. http://yourVirtualDirectory/ExternalImages/logo.jpg).

在IIS主机上创建一个指向C:\ Externalternal的虚拟目录。在控件中使用该虚拟目录路径。

Create a virtual directory on your IIS hosting machine that points to C:\ExternalImages. Use that virtual directory path in your control.

这篇关于设置Absolute ImageUrl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆