Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Dec 10, 2007 04:47 PM|LINK
Apologies if I've posted this in the wrong forum but I didn't know where else to post...
Ok, here's the scenario:
I have an application with two buttons, one of which I want to log the user off. The problem is that this runs as a startup program and runs off a network share. The app works fine on my local machine but whenever I try to run it from a network share, I
get security privilege errors:
Application attempted to perform an operation not allowed by the security policy... Request for the permission of type "System.Security.Permission, mscorlib, Version 184.108.40.206, Culture=neutral, PublicKey Token=b77a5c561934e089
Then I can continue or quit. How can I stop this error message box coming up?
If I go to the command line of the machine that I'm trying to run the app on and go to the .NET directory and run CasPol.exe -s off, it will then work. How can I get it to work everytime? I have tried:
Shell("CasPol -s off")
The other problem is that the machines I'm running the app on may have different .NET versions installed and in different places...
Here's my code:
Private Sub btDisagree_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDisagree.Click
'Shell("CasPol -s off")
The strange thing is that I have another app with the identical call (Shell("shutdown -l")) and it runs perfectly. There must be something I'm missing. if anyone can help me I'd be very grateful!!!
Failing this, can anyone tell me how to log off a user through a windows form without incurring security issues?
Thanks in advance,