Article ID: 941187 - Last Review: August 6, 2007 - Revision: 1.5

Unable to Run a .NET Framework Application from a Network Share created with SUBST

Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action



On a computer with Internet Explorer 7.0 or later installed, a user attempts to run a .NET Framework application from a network share that has been mapped with the SUBST command.

Result



The following error message is displayed:

myApplication.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

where myApplication is the name of the application.

If the error message is still displayed click the Debug button the the following message may be displayed:

An unhandled exception of type 'System.ArgumentException' occurred in Unknown Module

Additional information: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)

Setting the correct Code Access Security (CASPOL) setting as detailed in the following article does not resolve the issue:

897296 How to adjust security settings for Framework applications - http://support.microsoft.com/?id=897296 (http://support.microsoft.com/?id=897296)

Cause



This problem occurs due to differences in how Internet Explorer 6.0 and Internet Explorer 7.0 determine if a drive is valid.

When running a .NET Framework application from a network share that has been mapped using the SUBST command, the .NET Framework calls into the WNetGetConnection API to validate the drive. This calls fails with error code 0x80070043 - network name can not be found. This error code is masked with E_INVALIDARG (0x80070057) which is then returned to the .NET Framework, which displays the error.

Note that the same behavior does not occur on an Internet Explorer 6.0 computer. The call to WNetGetConnection fails in this circumstance as well, however, Internet Explorer 6.0 erroneously ignores the error and returns a successful result to the .NET Framework.

Resolution



Connect to the network share by using the Universal Naming Convention (UNC) path or by mapping the share with the Map Network Drive wizard.

DISCLAIMER

MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Keywords: 
kbnomt kbrapidpub KB941187

Note: This article is from Microsoft Knowledage Base


How we have helped PC users like you

In the News: Read More In ...

Related problems posted by other users

more...