c# - Linking Image control and FileUpload control
问题描述
As the heading suggests, I'm trying to give the user the option to choose an image using the FileUpload control and after hitting the update button, display it in the Image control, existing inside a Panel control.
So far I've gotten here. This is my form.
And this is my code.
I let the highlighted code stay inside PageLoad function just for testing. I know it should be inside the Button's event handler.
Also, can someone explain me why the above fails to display the image even after hardcoding an absolute URL for Image.ImageUrl property. It worked when I referenced it just by giving the file name cake.png and putting the file inside the website folder. But I want to reference absolute URLs.
Any and all help is appreciated. Thanks.
解决方案
您正在创建一个 Web 应用程序,该应用程序可以在 Internet 上使用,并且可以在全球范围内访问。在您的示例中,该示例不起作用,您正在 Web 应用程序中从您自己的计算机上引用本地文件系统中的图像文件。您的 Web 应用程序在其自己的进程和自己的帐户/用户(IIS 的情况下为 IUSR)下运行,并且您的本地系统在不同的进程下运行。所以两个人不能这样说话。
推荐阅读
- python - 如何在 Nornir 中使用 Ansible Style 动态库存?
- powershell - 新团队不返回 groupID
- localhost - 如何在另一台 PC 上访问 Wamp Web 应用程序
- java - 是否可以以编程方式更改 android 应用程序的分辨率?
- c# - 如何停止重复添加浮点数并生成非常大的数字但仍希望代码更新浮点数
- javascript - 从 Material UI 表和模态中理解内存泄漏 - React
- c - 静态链接中的静态函数与非静态?
- c# - 如何使用chart.js堆积条形mvc(使用.net mvc)显示标签中的值总和
- oauth - Firebase 身份验证:切换提供程序
- html - 如何使用 Ampscripts 使 N/A 值不可点击