Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello,

I have developed a .net windows application.
When i am running application in windows 8 so it's coming error.
Permission issue.
and
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Access to the path is denied.
at System.IO.FileSystemInfo.set_Attributes(FileAttributes value)
at Vint3DWinApplication.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34014 built by: FX45W81RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Vint3DWinApplication
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Vint3D/Vint3DSetup/Vint3DWinApplication.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitdebugging="true">


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

My application running successfully on win7 and winxp.
but it's not running in win8.

How can we develop comparability .net windows application?

Please help me.

Thanks in Advance.


Ankit Agarwal
Software Engineer
Posted
Comments
ZurdoDev 1-Jul-14 9:37am    
You have to give it proper permissions. I don't know that there is a way around that.
Sergey Alexandrovich Kryukov 1-Jul-14 10:13am    
Giving the permission is not the best solution is most cases. Better one would be not violating the current permissions.
As to the "way around": if it was possible, who would need UAC at all?
So, please see my answer.
—SA
SRS(The Coder) 1-Jul-14 9:44am    
Please try with running the application as Administrator.
Right click on the solution/project file choose 'Run As Administrator'.

Hope this will work for you.

1 solution

If there was a way to trick permission system around, nobody would need such system. Isn't that logical?

What you can do? First and the most usual choice would be: work only with legitimate directories, for example, those reserved in your system according to the current user account, or for "all users". Please see my past answer:
How to find my programs directory[^].

Another approach would be giving proper permissions for using certain file system objects to certain users.

And, finally, you can execute your application under the elevated permissions: http://www.eightforums.com/tutorials/9564-run-administrator-windows-8-a.html[^].

Can you do it programmatically? Of course not, by the reason mentioned in the first paragraph of this answer. You cannot bypass the UAC dialog. You can do only one thing: create and embed the application manifest which requests elevated permissions from the very beginning, when you start the application. The user having administrative will either accept or deny elevation, but won't face the permission exception:
http://msdn.microsoft.com/en-us/library/bb756929.aspx[^].

See also: http://en.wikipedia.org/wiki/User_Account_Control[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900