Click here to Skip to main content
15,885,941 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Sir,

I have 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.



MSIL
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
Posted

Did you follow the instructions in the error message?

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 would right click the directory and not just one file).
 
Share this answer
 
Comments
Silver Lightning 22-Mar-11 21:45pm    
I already did sir, but I can't find the asp.net account. I'm using windows7. what would I do sir? thanks
Steve Wellens 22-Mar-11 21:49pm    
Try using the IUSR account.

http://learn.iis.net/page.aspx/140/understanding-built-in-user-and-group-accounts-in-iis-7/

"Set file system permissions for the IUSR account by using Windows Explorer "
Silver Lightning 22-Mar-11 22:33pm    
thanks sir, but still not working, the error is on how could I access a particular directory that my web application is using. can you give me a simple solution sir? thanks
Steve Wellens 23-Mar-11 0:03am    
Follow the instructions in the error message but instead of the ASP.NET account, use the IUSR account or the IIS_IUSRS account.
Silver Lightning 23-Mar-11 3:43am    
thanks sir, I did it through updating the user authentication in folder. Have a nice day & God bless...
hi sir please help me on this sir.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900