无法将图像文件上传到Web服务器 [英] Unable to upload image file to web server

查看:145
本文介绍了无法将图像文件上传到Web服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用ASP.NET将图像文件上传到Web服务器时,它会通过异常"拒绝访问"来将其上传到Web服务器.我使用以下代码上传图像文件:

When I trying to upload an image file to webserver using ASP.NET it through an exception "Access denied". I''ve used the following code to upload image file:

ImageUploader.PostedFile.SaveAs(Server.MapPath(imagePath) + imageName);



但是,当我尝试在同一台服务器上通过经典ASP上传图像文件时,它可以工作.

当我在web.config文件中设置< identity impersonate ="true"> 时,图像上传在asp.net中起作用.但是在那种情况下,水晶报表无法正常工作.

因此,我的问题是Web服务器中是否存在任何与权限或安全性相关的问题,或者我的代码中存在问题.



But, When I try to upload an image file by classic asp in same server it works.

When I set <identity impersonate="true"> in web.config file image uploading works in asp.net. But in that case crystal report is not working.

So, my question is there any permission or security related issue in web-server or there is problem in my code.

推荐答案

尝试通过为将 IIS_IUSRS "和"网络服务"帐户添加到要在其中上传文件的文件夹中.
Try by providing Full-Rights permissions to "IIS_IUSRS" and "Network Services" Accounts to your Folder in which you are uploading Files.


是,可以授予对网络服务的完整权限RaisKazi告诉用户.
在模拟中,使用UserId和Password.冒名顶替建议您代表谁正在运行Web应用程序
yes give full rights to Network Services user as RaisKazi told.
in Impersonation use UserId and Password. Impersonation suggest on whos behalf you are running web application
<identity impersonate="true" username="Administrator" password="PWD" />


这篇关于无法将图像文件上传到Web服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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