MVCのページのリンクをクリックしてもファイルを開くことができません。私は次のメッセージを受け取ります。コードに偽装を追加しました。私はファイルを削除して保存することができます。ファイルを読み取る際にエラーが発生しました
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
完全なソースコードサンプルを扱った最終的な解決策はどれですか? – Kiquenet
それは長い時間が戻っていた。私は正しく覚えていない。しかし、それはIISアプリケーションプールで何かでした –
これは残念ですが、この質問は決して答えになりません。たぶんあなたはそれを覚えて自分の質問に答えることができますし、あなたがそれについて覚えることができるすべての質問を更新することができます。 – Kiquenet