Could not find a part of the path - User control from within IE

Could not find a part of the path - User control from within IE

Post by TGVzbGl » Fri, 14 Apr 2006 03:36:01


I have developed a usercontrol which is downloaded from a web site and
executes in Internet Explorer. This control writes files to the user's temp
directory on the local workstation.
The control has worked fine during development but fails when executed from
a web server that is not localhost. The message below is returned.
Could not find a part of the path
'C:\Documents~and~Settings\masonlf\Local~Settings\Temp\SRP\~ST000001~CMD.ico'.
Is this a security settings problem? If so, how do I set dotnet
configuration to allow this to run from other servers?

I have tried to sign the control with a strong name, but that has failed
since the control references other interop assemblies.

Thanks,

Leslie
 
 
 

Could not find a part of the path - User control from within IE

Post by stchen » Fri, 14 Apr 2006 16:30:06

Hi Leslie,

Welcome to the MSDN newsgroup.

From your description, I understand you've developed an .NET winform
control which is hosted in a web page(IE hosted), the control will access
files in the client computer's user profile local temp dir. However, you
find that the client runtime will always report "Could not find a part of
the path ......" exception, correct? If anything I missed, please feel free
to let me know.

Based on my experience, for IE hosted .net winform control, the most
important thing is configuring the client-side .NET runtime's CAS
permission if our control will access any particular sensitive or protected
resource on the client machine. And based on the error info you provided, I
don't think it is likely a permission issue but like the path is not a
valid one so that the System.IO api can not find the correct path. so I
suggest you try accessing a uplevel folder to see whether the control can
access it(make sure the path is valid). e.g:

=========================
private void btnTest_Click(object sender, System.EventArgs e)
{

string path = @"C:\Documents and Settings\username\Local
Settings\Temp";
DirectoryInfo di = new DirectoryInfo(path);

FileInfo[] files = di.GetFiles();


MessageBox.Show( files.Length.ToString());
}
============================
'
In addition, if you want to check whether the problem is related to CAS
permission setting, you can try using the "caspol.exe" tool to turn off the
client machine's .NET CAS checking temporarily and test it to see whether
the problem remains( if remains, it is not due to CAS setting):

#Code Access Security Policy Tool (Caspol.exe)
http://www.yqcomputer.com/
l/cpgrfcodeaccesssecuritypolicyutilitycaspolexe.asp

BTW, since the IE hosted winform control will always be hosted in the
latest framework installed on the client machine, you should use the caspol
under the framework of correct version's folder.

Hope this helps. If there is anything else we can help, please feel free to
post here.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
 
 

Could not find a part of the path - User control from within IE

Post by stchen » Tue, 18 Apr 2006 20:47:57

Hi Leslie,

How are you doing on this issue? Have you got any progress or did my last
reply helps a little? If there's anything else we can help, please feel
free to post here.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.