Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


<< Go Back

System Argumentexception Absolute Path Information Is Required

- 18 Dec 2007

You have a .NET 2.0 control hosted in a browser.  The control uses the System.Uri class.  When upgrading to .NET 2.0 SP1 you can get an error: System.ArgumentException: Absolute path information is required.

Four conditions must exist for this to happen:

1. Using the 2.0 Framework SP1
2. Control uses the System.Uri class
3. Uri class passed a URI that has escaped characters (% escaped or puny code)
4. Control has a .config file on the http server

The same error can occur in an application that Creates an AppDomain and points to a web location for the application configuration file.

The problem occurs because of a new test in the System.Uri class that checks for a config file when it encounters an escaped URI as an input.  It demands that the configuration file reside on a local disk.  If the class is a WebApplication (ASP.NET) then it will not have the problem.  Due to the nature of this test, you have to fool the code to make it think it is a web application.  The control will have to have the necessary permissions to modify the appdomain however.

For a Browser hosted control you could do this:<p class=MsoNormal style="MARGIN: 0in 0in 0pt">

AppDomain.CurrentDomain.SetData(“.appVPath”, “/”);<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /></p>

or if you have created your own domain (in a desktop app for example) set that domain property:

myNewDomain.SetData(“.appVPath”, “/”);

Hope this helps!  Let me know if you are able to use this information.

<< Go Back