Ich kann die Datei nicht öffnen, wenn ich auf den Link auf der Seite in MVC klicke. Ich bekomme die folgende Nachricht. Ich habe den Identitätswechsel im Code hinzugefügt. Ich kann die Datei löschen und speichern.Fehler beim Lesen einer Datei
Access to the path '\servername\folder1\folder2\folder3\foder4\filename.pdf' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the path '......same as above....' 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
<identity impersonate="true"/>
, 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.
Source Error:
Line 35: ' This gets executed for every action on this controller Line 36: ViewData("READONLY") = IIf(SessionData.IsReadOnly, "Y", "N") Line 37: MyBase.Execute(requestContext) Line 38: End Sub Line 39:
Source File: C:\Posfx\trunk\posfx\camonline\Controllers\ApplicationController.vb Line: 37
Stack Trace:
[UnauthorizedAccessException: Access to the path '\\cambridge-uat-d\NetworkShare\DealDocumentShare\201102\online\136-test file 2.pdf' is denied.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7716623 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) +1162 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +66 System.Web.HttpResponse.TransmitFile(String filename, Int64 offset, Int64 length) +134 System.Web.HttpResponse.TransmitFile(String filename) +12 System.Web.HttpResponseWrapper.TransmitFile(String filename) +11 System.Web.Mvc.FilePathResult.WriteFile(HttpResponseBase response) +37 System.Web.Mvc.FileResult.ExecuteResult(ControllerContext context) +268 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +10 System.Web.Mvc.<>c__DisplayClass11.<InvokeActionResultWithFilters>b__e() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251 System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251 System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251 System.Web.Mvc.<>c__DisplayClass13.<InvokeActionResultWithFilters>b__10() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +178 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399 System.Web.Mvc.Controller.ExecuteCore() +126 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27 Cambridge.Online.ApplicationController.Execute(RequestContext requestContext) in C:\Posfx\trunk\posfx\camonline\Controllers\ApplicationController.vb:37 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Irgendeine endgültige Lösung mit dem vollständigen Quellcode, der daran arbeitet? – Kiquenet
Es war lange zurück. Ich erinnere mich nicht richtig. Aber es war etwas mit IIS-Anwendungspool –
Es ist schade, diese Frage wird nie eine Antwort sein. Vielleicht können Sie sich daran erinnern und Ihre eigene Frage beantworten, oder besser, Sie aktualisieren Ihre Frage mit allem, woran Sie sich erinnern können. – Kiquenet