Possible Duplicate:
How to force C# App to run as administrator on Windows 7
I have created a .NET application which does some file handling stuff. The problem I'm facing in Windows Vista and Windows 7 is that if the user doesn't right-click to run the application as an administrator he/she gets an unhanded exception window.
Is there a way to bypass this?
Following is the stacktrace:-
************** Exception Text **************
System.UnauthorizedAccessException: Please run the application as an administrator
at .(Object , EventArgs )
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)
Please let me know if there's something that could be done to avoid it.
Thanks, Ron