Microsoft
Software
Hardware
Network
Question : File Upload & Download using ASP.net 2.5 & MVC2.0
I have trying to upload file using the below code
public ActionResult Upload(HttpPostedFileBase FileUpload)
{
string fileName = Path.GetFileName(FileUploa
d.FileName
);
byte[] buf = new byte[FileUpload.ContentLen
gth];
fileTransferInfo.FileName = Server.HtmlEncode(fileName
);
FileUpload.InputStream.Rea
d(buf, 0, FileUpload.ContentLength);
FileUpload.SaveAs(@"C:\MyU
ploadedFil
es");
}
And getting the following error.
System.UnauthorizedAccessE
xception: Access to the path 'C:\MyUploadedFiles' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via
, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
I have tried grading permission to appropriate user or group.But nothing solved my problem.Can any one help /
Answer : File Upload & Download using ASP.net 2.5 & MVC2.0
use fiddler to track down the connections
Random Solutions
Can't run eseutil on Exchange 2k3 server
How to delete a word bookmark when the document is launched from an Access form?
Microsoft SQL 2005
Exclude all records from a join which have two specific values in one table
Visual Studio 2008 Pro Trial does work with SQL 2008 CTP Trial
Automatically inserting records in a temp table
How to make dropdown disappear using code
windows 7 offline files: the process cannot access the file because it is being used by another process offline
Check for existence of index with INFORMATION_SCHEMA?
UCC SSL certificate?