在上传任何文件时获取实时webisite的例外

在上传任何文件时获取实时webisite的例外

本文介绍了在上传任何文件时获取实时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.

推荐答案


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

08-24 05:08