jess romero

jess romero

  • NA
  • 14
  • 23.4k

Please help me on this error in accessing directory file while I'm running my asp.net application (c#)

Mar 22 2011 9:28 PM
Hi Sir,

Good day!
Im having an error while I'm running my web application (LAN) using the IP ADDRESS, but it was ok in my local host during testing. Please help me on how could I rid of this error and how to access the particular directory. Here's the error below. thanks in advance sir.



Collapse | Copy Code
Server Error in '/Irocweb' Application.
--------------------------------------------------------------------------------

Access to the path '\\10.229.71.88\IROCDIR\WMXMODEM\20110323' 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 '\\10.229.71.88\IROCDIR\WMXMODEM\20110323' 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 45: //string dirFile = @"\\10.229.71.88\IROCDIR\con_d_ConOrd_JL\CLUSTERED\WMXMODEM\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
Line 46: string dirFile = @"\\10.229.71.88\IROCDIR\WMXMODEM\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
Line 47: string[] srchFile = System.IO.Directory.GetFiles(dirFile);
Line 48:
Line 49: //Array.Sort(srchFile);


Source File: c:\inetpub\wwwroot\irocweb\ConOrdJL.aspx.cs Line: 47

Stack Trace:


[UnauthorizedAccessException: Access to the path '\\10.229.71.88\IROCDIR\WMXMODEM\20110323' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +7716783
System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption) +1923
System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption) +37
System.IO.Directory.GetFiles(String path) +14
ConOrdJL.Get_JL_File() in c:\inetpub\wwwroot\irocweb\ConOrdJL.aspx.cs:47
ConOrdJL.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\irocweb\ConOrdJL.aspx.cs:21
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Answers (2)