c# - ASP.NET is not authorized to access the requested resource when accessing temp folder -
my application have created using asp.net , c# uses temporary path store document whilst read, , deletes after:
string path = string.concat((server.mappath("~/temp/" + fileupload1.filename))); array.foreach(directory.getfiles((server.mappath("~/temp/"))), file.delete);
thankyou help. stockcontrol document illustration , imported multiple computers on network. based on error message looks file not beingness uploaded , saved temp directory...
local path when debugging (works):
c:\users\user\documents\visual studio 2013\projects\webapplication5\webapplication5\temp
the application deployed when attach file , press "import", displayed error message: access path 'c:\inetpub\wwwroot\stockcontrol\temp\book1.xls' denied.
description: unhandled exception occurred during execution of current web request. please review stack trace more info error , originated in code.
exception details: system.unauthorizedaccessexception: access path 'c:\inetpub\wwwroot\stockcontrol\temp\book1.xls' denied.
asp.net not authorized access requested resource. consider granting access rights resource asp.net request identity. asp.net has base of operations process identity (typically {machine}\aspnet on iis 5 or network service on iis 6 , iis 7, , configured application pool identity on iis 7.5) used if application not impersonating. if application impersonating via , identity anonymous user (typically iusr_machinename) or authenticated request user.
to grant asp.net access file, right-click file in file explorer, take "properties" , select security tab. click "add" add together appropriate user or group. highlight asp.net account, , check boxes desired access.
source error:
an unhandled exception generated during execution of current web request. info regarding origin , location of exception can identified using exception stack trace below.
a simple prepare solve issue, in iis had right click on application pools , set .net framework v4 integrated rather classic/
another solution set specific folder beingness accessed read/write users required it, can done unique users or within organization, grouping of users
c# asp.net iis
No comments:
Post a Comment