FIX: "Value Cannot Be Null. Parameter Name: path2" Error Message When You Browse to ASP.NET Pages (320117)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework) 1.0

This article was previously published under Q320117

SYMPTOMS

When you open ASP.NET (.aspx) pages in your browser, you may receive the following error message and stack trace:
Value cannot be null. Parameter name: path2.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: path2]
   System.IO.Path.Combine(String path1, String path2)
   System.Web.FilePathParse..ctor(String path, Boolean isFile, Boolean getShortNames)
System.Web.FileChangesMonitor.StartMonitoringDirectoryRenamesAndBinDirectory(String dir, FileChangeEventHandler callback)
   System.Web.HttpRuntime.StartMonitoringDirectoryRenamesAndBinDirectory()
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) 

[HttpException (0x80004005): ASP.NET Initialization Error]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
				

CAUSE

File Change detection requires that the process identity and the impersonated user identity have specific permissions to all of the directories in the hierarchy of the file path for the file that ASP.NET is monitoring if any of the directories in that hierarchy have more than eight characters in their names.

Some of the files that ASP.NET monitors are:
  • Web.config files
  • Machine.config file
  • Bin directory of an ASP.NET application
  • Cache dependency files
You receive this error message if all of the following conditions are true:
  • The root directory has more than eight characters.
  • The rest of the directories in the file path have less than nine characters.
  • The Aspnet_wp.exe process identity (the ASPNET account by default) or the impersonated account does not have permissions on the root directory in the hierarchy of that file path.
If the file path hierarchy does not match this condition exactly, you may receive a different error message. For more information, see the "References" section of this article.

RESOLUTION

To work around this problem, use one of the following methods.

Workaround 1

Make sure that all of the directory names in the hierarchy of that file path are less than nine characters long. For example:

C:\Web\Users\MainDir\Site1

Workaround 2

Grant the required permissions to the Aspnet_wp.exe process identity (the ASPNET account by default) on all of the directories in that hierarchy or the impersonated account (if impersonation is turned on).

To do this, follow these steps:
  1. In Windows Explorer, locate the application folder or the virtual directory that contains the content (for example, D:\MyWebApplications\Users\Main\App1).
  2. Right-click the root folder (MyWebApplications in this case), and then click Properties.
  3. On the Security tab, click Add.
  4. Type ComputerName\ASPNET (for example, on a computer that is named Webdev, type Webdev\ASPNET), and then click OK. Add the impersonated accounts if impersonation is turned on.
  5. Grant the following permissions for the ASPNET account (and for the impersonated accounts if impersonation is turned on):
    • Read & Execute
    • List Folder Contents
    • Read

  6. Click OK to close the Properties dialog box and to save the changes.
If you have to grant more restrictive permissions to these folders, follow these steps after you complete step 4:
  1. Click Advanced to access special permissions or advanced settings.
  2. Click the Permissions tab, and then select the permission entry for the ASPNET (or other impersonated account).
  3. Click View/Edit.
  4. Make sure that you grant only the List Folder/Read Data permission.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in ASP.NET (included with the .NET Framework) 1.1.

MORE INFORMATION

If the error message that you receive is the same as the error message that is listed in the "Symptoms" section of this article, but the stack trace does not match the stack trace in the "Symptoms" section, the cause of your error message may be different. For more information, see the "References" section of this article.

REFERENCES

For additional information about a different error message for the same cause, click the article number below to view the article in the Microsoft Knowledge Base:

316721 PRB: "Failed to Start Monitoring Directory Changes" Error Message When You Browse to ASP.NET Page

317955 BUG: "Failed to Start Monitoring Directory Changes" Error Message When You Browse to an ASP.NET Page

For additional information about the minimum permissions that you must grant to the ASPNET account to run your ASP.NET applications, click the article number below to view the article in the Microsoft Knowledge Base:

317012 INFO: Process and Request Identity in ASP.NET

For additional information about ASP.NET security, click the article number below to view the article in the Microsoft Knowledge Base:

306590 INFO: ASP.NET Security Overview


Modification Type:MajorLast Reviewed:3/21/2003
Keywords:kbfix kbbug kbConfig kbSecurity KB320117