How to run application from network folder
-
Managed code .NET 3.5 C# WinForms application runs OK from Vista when in local drive. When application is copied to mapped network drive or started from \\othercmp\c\myapp\myapp.exe folder , it does not start: Vista shows MyApp has stopped working Windows is checking for a solution to the problem.. How to fix ?
Andrus
-
Managed code .NET 3.5 C# WinForms application runs OK from Vista when in local drive. When application is copied to mapped network drive or started from \\othercmp\c\myapp\myapp.exe folder , it does not start: Vista shows MyApp has stopped working Windows is checking for a solution to the problem.. How to fix ?
Andrus
It's because of the trust level assigned to the app. .net exe files run off of a network share are assigned a low trust level. (As opposed to full trust when run locally). If you want your app to automatically just work from a network share you need to design it so it doesn't require full trust. This means you can't do anything like writing to the local file system, using the registry, and a whole bunch of other stuff. (There are often alternatives, like you could use isolated storage for settings instead of the registry). Or, you can adjust the security to either explicitly trust a specific strong name signed assembly, no matter where is it run from[^] or explicitly allow full trust for apps run from a given network location[^]
Simon
-
It's because of the trust level assigned to the app. .net exe files run off of a network share are assigned a low trust level. (As opposed to full trust when run locally). If you want your app to automatically just work from a network share you need to design it so it doesn't require full trust. This means you can't do anything like writing to the local file system, using the registry, and a whole bunch of other stuff. (There are often alternatives, like you could use isolated storage for settings instead of the registry). Or, you can adjust the security to either explicitly trust a specific strong name signed assembly, no matter where is it run from[^] or explicitly allow full trust for apps run from a given network location[^]
Simon
If you want your app to automatically just work from a network share you need to design it so it doesn't require full trust I need that in MDI child form Escape key closes form, Ctrl+F1 cycles and Ctrl+F10 toggles maximizing. For this I use code below in form base class which requires full trust. How to implement those features without full trust ? Andrus.
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Escape:
if (this != FormManager.MainForm)
{
Close();
return true;
}
break;case Keys.Control | Keys.F1: for (int i = 0; i < FormManager.MainForm.MdiChildren.Length; i++) { if (FormManager.MainForm.MdiChildren\[i\] == this) { if (i < FormManager.MainForm.MdiChildren.Length - 1) FormManager.MainForm.MdiChildren\[i + 1\].Focus(); else FormManager.MainForm.MdiChildren\[0\].Focus(); return true; } } return true; case Keys.Control | Keys.F10: if (WindowState == FormWindowState.Maximized) WindowState = FormWindowState.Normal; else WindowState = FormWindowState.Maximized; return true; } return base.ProcessCmdKey(ref msg, keyData); } }
Andrus
-
If you want your app to automatically just work from a network share you need to design it so it doesn't require full trust I need that in MDI child form Escape key closes form, Ctrl+F1 cycles and Ctrl+F10 toggles maximizing. For this I use code below in form base class which requires full trust. How to implement those features without full trust ? Andrus.
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Escape:
if (this != FormManager.MainForm)
{
Close();
return true;
}
break;case Keys.Control | Keys.F1: for (int i = 0; i < FormManager.MainForm.MdiChildren.Length; i++) { if (FormManager.MainForm.MdiChildren\[i\] == this) { if (i < FormManager.MainForm.MdiChildren.Length - 1) FormManager.MainForm.MdiChildren\[i + 1\].Focus(); else FormManager.MainForm.MdiChildren\[0\].Focus(); return true; } } return true; case Keys.Control | Keys.F10: if (WindowState == FormWindowState.Maximized) WindowState = FormWindowState.Normal; else WindowState = FormWindowState.Maximized; return true; } return base.ProcessCmdKey(ref msg, keyData); } }
Andrus
Handle the forms keypress or keydown events instead of overriding the ProcessCmdKey method. Use code in their to max/min/cycle your forms based on the key pressed.
Simon
-
Handle the forms keypress or keydown events instead of overriding the ProcessCmdKey method. Use code in their to max/min/cycle your forms based on the key pressed.
Simon
-
http://www.codeproject.com/KB/database/DatabaseAcessWithAdoNet1.aspx[^] states that DataGridView and other controls do not raise those events. How I can use those events when DataGridView is active?
Andrus
Ahh...interesting. Have you tried the _forms_ previewkeydown event? (You have to set keypreview to true)
Simon
-
It's because of the trust level assigned to the app. .net exe files run off of a network share are assigned a low trust level. (As opposed to full trust when run locally). If you want your app to automatically just work from a network share you need to design it so it doesn't require full trust. This means you can't do anything like writing to the local file system, using the registry, and a whole bunch of other stuff. (There are often alternatives, like you could use isolated storage for settings instead of the registry). Or, you can adjust the security to either explicitly trust a specific strong name signed assembly, no matter where is it run from[^] or explicitly allow full trust for apps run from a given network location[^]
Simon
I ran with adminstrator rights in Vista CasPol.exe -m -ag 1.2 -url file://z:/myapp/* FullTrust
C:\...crosoft.NET\Framework\v2.0.50727>g 1.2 -url file://z:/myapp/* FullTrust
Microsoft (R) .NET Framework CasPol 2.0.50727.1434
Copyright (c) Microsoft Corporation. All rights reserved.The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
y
Added union code group with "-url" membership condition to the Machine level.
SuccessHowever z:\myapp\myapp.exe still shows immediately Myapp as stopped working
Andrus
-
I ran with adminstrator rights in Vista CasPol.exe -m -ag 1.2 -url file://z:/myapp/* FullTrust
C:\...crosoft.NET\Framework\v2.0.50727>g 1.2 -url file://z:/myapp/* FullTrust
Microsoft (R) .NET Framework CasPol 2.0.50727.1434
Copyright (c) Microsoft Corporation. All rights reserved.The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
y
Added union code group with "-url" membership condition to the Machine level.
SuccessHowever z:\myapp\myapp.exe still shows immediately Myapp as stopped working
Andrus
Sorry, I've no idea about this. Try catching and logging exceptions at the top level to see what's going wrong.
Simon
-
Ahh...interesting. Have you tried the _forms_ previewkeydown event? (You have to set keypreview to true)
Simon
http://blogs.msdn.com/jfoscoding/archive/2005/01/24/359334.aspx[^] States that MDI Parent form ProcessCmdKey is called before PreviewKeyDown. Probably Main form ProcessCmdKey consides those keys as special keys and processec them, it will not pass them to PreviewKeyDown.
Andrus
-
Sorry, I've no idea about this. Try catching and logging exceptions at the top level to see what's going wrong.
Simon
-
I ran with adminstrator rights in Vista CasPol.exe -m -ag 1.2 -url file://z:/myapp/* FullTrust
C:\...crosoft.NET\Framework\v2.0.50727>g 1.2 -url file://z:/myapp/* FullTrust
Microsoft (R) .NET Framework CasPol 2.0.50727.1434
Copyright (c) Microsoft Corporation. All rights reserved.The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
y
Added union code group with "-url" membership condition to the Machine level.
SuccessHowever z:\myapp\myapp.exe still shows immediately Myapp as stopped working
Andrus
Hi! There's a control panel for the configuration of .NET 2.0 if you have the SDK installed. When you select "Runtime security policies" (I hope that's the correct name, I only have the German version here...) you get the option to evaluate a given assembly with respect to all the permissions this assembly is granted. You could test your assembly to verify that the change in your security policy actually affects your application.
Regards, mav -- Black holes are the places where God divided by 0...
-
http://blogs.msdn.com/jfoscoding/archive/2005/01/24/359334.aspx[^] States that MDI Parent form ProcessCmdKey is called before PreviewKeyDown. Probably Main form ProcessCmdKey consides those keys as special keys and processec them, it will not pass them to PreviewKeyDown.
Andrus
Sorry then, I'm out of ideas. There should be a way though. Detecting a key press barely seems like something that should require full trust.
Simon
-
Sorry then, I'm out of ideas. There should be a way though. Detecting a key press barely seems like something that should require full trust.
Simon
-
Hi! There's a control panel for the configuration of .NET 2.0 if you have the SDK installed. When you select "Runtime security policies" (I hope that's the correct name, I only have the German version here...) you get the option to evaluate a given assembly with respect to all the permissions this assembly is granted. You could test your assembly to verify that the change in your security policy actually affects your application.
Regards, mav -- Black holes are the places where God divided by 0...
.NET 2 SDK downlaod page says that this is obsolete and recommends to download Windows SDK for Windows Server 2008 and .NET Framework 3.5 from http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en[^] Whoe package is 1.3 GB to download which is too much. Which options I must select to install security utility ?
Andrus
-
.NET 2 SDK downlaod page says that this is obsolete and recommends to download Windows SDK for Windows Server 2008 and .NET Framework 3.5 from http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en[^] Whoe package is 1.3 GB to download which is too much. Which options I must select to install security utility ?
Andrus
Don't know, sorry. Don't you have VS2005 installed? In that case, the .NET 2.0 SDK is already installed.
Regards, mav -- Black holes are the places where God divided by 0...
-
Don't know, sorry. Don't you have VS2005 installed? In that case, the .NET 2.0 SDK is already installed.
Regards, mav -- Black holes are the places where God divided by 0...
I have Visual C# Express 2008 Installed. I intalled "SDK Tools" from "Windows and .NET SDK" package but Control Panel does not show this utility. Installer created 2 directories, v6.0a and v6.1 containing files with same names. I tried some executables in v6.1 directory but they appear to do other things.
Directory of C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin
31.07.2008 12:06 <DIR> .
31.07.2008 12:06 <DIR> ..
07.11.2007 12:01 72_688 al.exe
06.11.2007 21:53 140 al.exe.config
16.01.2008 17:21 40_960 apatch.exe
07.11.2007 12:01 913_416 aspnet_merge.exe
07.11.2007 12:01 58_360 AxImp.exe
16.01.2008 17:21 510_976 capicom.dll
16.01.2008 17:21 20_992 Cert2Spc.exe
16.01.2008 17:21 74_752 CertMgr.Exe
16.01.2008 17:21 30_208 checkv4.exe
07.11.2007 12:01 66_040 clrver.exe
16.01.2008 17:21 23_552 Consume.exe
07.11.2007 12:01 185_336 cordbg.exe
07.11.2007 12:01 72_192 CorFlags.exe
16.01.2008 17:21 60_416 ctrpp.exe
19.06.2006 14:09 247 dasmhlp.cnt
19.06.2006 14:09 21_963 DASMHLP.HLP
22.01.2008 12:11 58_360 disco.exe
31.07.2008 12:03 <DIR> en-us
07.11.2007 12:01 107_520 FUSLOGVW.exe
07.11.2007 12:01 106_496 gacutil.exe
06.11.2007 20:07 181 gacutil.exe.config
16.01.2008 17:21 132_608 genmanifest.exe
07.11.2007 12:01 31_744 guidgen.exe
07.11.2007 12:01 386_040 ildasm.exe
06.11.2007 20:07 181 ildasm.exe.config
11.12.2007 14:15 3_105 INSTLR1.ADM
11.12.2007 14:15 9_179 instlr11.adm
08.01.2008 17:19 596 isvtier5appsigningprivkey.dat
08.01.2008 17:19 148 isvtier5appsigningpubkey.dat
08.01.2008 17:19 21_234 isvtier5appsignsdk.cc
08.01.2008 17:19 4_916 isvtier5appsignsdk.xml
08.01.2008 17:19 56_994 isvtier5appsignsdk_client.xml
07.11.2007 12:01 46_064 lc.exe
07.11.2007 12:01 78_840 mage.exe
07.11.2007 12:01 463_864 mageui.exe
16.01.2008 17:21 123_904 make-shell.exe
16.01.2008 17:21 30_720 MakeCat.Exe
16.01.2008 17:21 57_856 makecert.exe
07.11.2007 12:01 111_608 Mdbg.exe
22.01.2008 12:11 376_832 MdbgCore.dll
22.01.2008 12:11 104_960 MdbgDis. -
I have Visual C# Express 2008 Installed. I intalled "SDK Tools" from "Windows and .NET SDK" package but Control Panel does not show this utility. Installer created 2 directories, v6.0a and v6.1 containing files with same names. I tried some executables in v6.1 directory but they appear to do other things.
Directory of C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin
31.07.2008 12:06 <DIR> .
31.07.2008 12:06 <DIR> ..
07.11.2007 12:01 72_688 al.exe
06.11.2007 21:53 140 al.exe.config
16.01.2008 17:21 40_960 apatch.exe
07.11.2007 12:01 913_416 aspnet_merge.exe
07.11.2007 12:01 58_360 AxImp.exe
16.01.2008 17:21 510_976 capicom.dll
16.01.2008 17:21 20_992 Cert2Spc.exe
16.01.2008 17:21 74_752 CertMgr.Exe
16.01.2008 17:21 30_208 checkv4.exe
07.11.2007 12:01 66_040 clrver.exe
16.01.2008 17:21 23_552 Consume.exe
07.11.2007 12:01 185_336 cordbg.exe
07.11.2007 12:01 72_192 CorFlags.exe
16.01.2008 17:21 60_416 ctrpp.exe
19.06.2006 14:09 247 dasmhlp.cnt
19.06.2006 14:09 21_963 DASMHLP.HLP
22.01.2008 12:11 58_360 disco.exe
31.07.2008 12:03 <DIR> en-us
07.11.2007 12:01 107_520 FUSLOGVW.exe
07.11.2007 12:01 106_496 gacutil.exe
06.11.2007 20:07 181 gacutil.exe.config
16.01.2008 17:21 132_608 genmanifest.exe
07.11.2007 12:01 31_744 guidgen.exe
07.11.2007 12:01 386_040 ildasm.exe
06.11.2007 20:07 181 ildasm.exe.config
11.12.2007 14:15 3_105 INSTLR1.ADM
11.12.2007 14:15 9_179 instlr11.adm
08.01.2008 17:19 596 isvtier5appsigningprivkey.dat
08.01.2008 17:19 148 isvtier5appsigningpubkey.dat
08.01.2008 17:19 21_234 isvtier5appsignsdk.cc
08.01.2008 17:19 4_916 isvtier5appsignsdk.xml
08.01.2008 17:19 56_994 isvtier5appsignsdk_client.xml
07.11.2007 12:01 46_064 lc.exe
07.11.2007 12:01 78_840 mage.exe
07.11.2007 12:01 463_864 mageui.exe
16.01.2008 17:21 123_904 make-shell.exe
16.01.2008 17:21 30_720 MakeCat.Exe
16.01.2008 17:21 57_856 makecert.exe
07.11.2007 12:01 111_608 Mdbg.exe
22.01.2008 12:11 376_832 MdbgCore.dll
22.01.2008 12:11 104_960 MdbgDis.I'm afraid I don't know if this control panel is part of VS 2008 Express. With VS 2005 it's located at
C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin\mscorcfg.msc
Hope this helps...
Regards, mav -- Black holes are the places where God divided by 0...
-
I'm afraid I don't know if this control panel is part of VS 2008 Express. With VS 2005 it's located at
C:\Programme\Microsoft Visual Studio 8\SDK\v2.0\Bin\mscorcfg.msc
Hope this helps...
Regards, mav -- Black holes are the places where God divided by 0...