将 javascript 图像上传器添加到 .NET 网站 - 安全问题
我有一个基于 ASP.NET 和 C# 构建的网站。该网站的要求之一是允许用户在所见即所得类型的编辑器中输入文本以及上传图像。
我开始使用 .NET HTMLEditor 进行开发,一开始我很高兴。在花了几个小时尝试向控件添加图像上传器按钮后,我放弃了该控件。
相反,我现在使用 obout HTMLEditor,它工作得很好。它有一个图像上传器,我可以动态设置保存文件的位置,这很棒。现在,图像进入网站的一个子文件夹,我可以使用 IIS 部分锁定该子文件夹,以防止目录浏览等操作。
因为我对 javascript 知之甚少,所以我担心的是潜在的安全问题。之前,当我使用 .NET 代码进行图像上传时,我能够执行一系列步骤。我假设 javascript 代码以与运行该站点的 IIS 应用程序池相同的用户权限运行。
最后,问题来了。在 .NET 站点上实现 javascript 图像上传器是否安全?我看到的唯一其他解决方案是编写一个 .NET 图像上传器,然后使用“图像浏览器”控件将图像插入 HTMLEditor,但这对于用户来说似乎更困难。
I have a site built on ASP.NET and C#. One of the requirements of the site is to allow users to enter text in a WYSIWYG type editor as well as upload images.
I started development using the .NET HTMLEditor and at first was pleased. I gave up on the control after spending a handful of hours attempting to add an image uploader button to the control.
Instead I am now using the obout HTMLEditor and it's working great. It has an image uploader that I am able to dynamically set the location to save the files, which is great. Right now the images go into a sub-folder of the site that I can partially lock down with IIS to prevent things like directory browsing.
My concern, because I know very little about javascript, is in regards to potential security problems. Before, when I used .NET code for the image uploading, I was able to take a bunch of steps. I am assuming that the javascript code runs with the same user privileges as the IIS ApplicationPool that the site is running under.
So finally, the question. Is it secure to implement a javascript image uploader on a .NET site? The only other solution I see is to write a .NET image uploader and then use the "Image Browser" control to insert the images into the HTMLEditor, but that seems harder for the user.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,javascript 代码总是在客户端执行。使用 javascript 无法访问您的网络服务器的任何资源。
yes it is, javascript-code is always executed on the client side. its not possible to access any resources of your webserver with javascript.