在上传任何文件时获取实时webisite的例外 [英] Getting exception of live webisite at the time of uploading any file

查看:128
本文介绍了在上传任何文件时获取实时webisite的例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我开发了一个网页,我需要上传用户的图片。我为此编写代码并在本地服务器上测试它。但是当我将它上传到服务器上时它会给出异常



System.UnauthorizedAccessException:访问路径'C:\Inetpub \vhosts \ pspl-it.com \ site1 \ projects \ SBI - Copy.jpg'被拒绝。在System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)at System.IO.FileStream.Init(String path,FileMode mode,FileAccess access,Int32 rights,Boolean useRights,FileShare share,Int32 bufferSize,FileOptions options,SECURITY_ATTRIBUTES secAttrs) ,String msgPath,Boolean bFromProxy,Boolean useLongPath,Boolean checkHost)at ....

我的代码是





Hello
I have developed a webpage where i need to upload a image of user . I wrote code for that and tested it on local server. But when i uploaded it on server it giving exception

System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\vhosts\pspl-it.com\site1\projects\SBI - Copy.jpg' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at ....
And my code is


string filename =System.IO.Path.GetFileName(Fileimage.PostedFile.FileName);
      Fileimage.SaveAs(Server.MapPath("projects/") + filename);



请建议我。

提前使用。


Please suggest me.
Thanx in advance.

推荐答案

这是由于服务器中该文件夹的权限问题。



请转到其属性,为文件夹分配适当的权限。在Google中搜索此问题以获取更多信息。
This is due to the permission issue for that folder in server.

Please assign proper permission to the folder by going to its properties. Search the issue in Google for more information.


这篇关于在上传任何文件时获取实时webisite的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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