Reputation: 33
Getting this error when transferring a program to a new domain and new servers, and only for a few users:
"Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed."
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet grantedSet, PermissionSet deniedSet, CodeAccessPermission demand, PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Windows.Forms.FileDialog.set_Title(String value)
at mainForm.InitializeComponent() in C:\MyProjects\DTSExecuter.root\DTSExecuter\DWMaintenance\mainForm.vb:line 88
at mainForm..ctor() in C:\MyProjects\DTSExecuter.root\DTSExecuter\DWMaintenance\mainForm.vb:line 16
at mainForm.Main() in C:\MyProjects\DTSExecuter.root\DTSExecuter\DWMaintenance\mainForm.vb:line 4
My machine runs the application just fine, as do other users, but there are a small few users who get an "Application has generated an exception that could not be handled." error box, and when debugging it returns the above error. This is a legacy application that we may not have access to source code for, and it just changed connection strings within the internal connection manager. That was the only change to the application other than running on a new domain.
Upvotes: 1
Views: 5356
Reputation: 127603
I have run in to this before myself. If the starting location for the Open/SaveFileDialog is a network path and the account running the application does not have permissions to read the network path it will throw this exception.
Just set the value of InitalDirectory to something safe (like Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
) and it should fix the problem.
After re-reading the question, I see you can not change the source. The there is only two things I can suggest. The users who are having problems, have them use a shortcut to launch the program and set the Working Directory to a local path. If the original programmer did not set a InitalDirectory
it will default to the working directory.
The other thing to check is you said you moved to a new domain, make sure the users have permissions to whatever folder the program is trying to talk to. Perhaps the permissions where not migrated over correctly.
After seeing the comment in XPD's answer I think this is what is happening:
\\Foo\Bar\
and manually enters a username and password.\\Foo\Bar\Baz.exe
\\Foo\Bar\
InitalDirectory
was set for the dialog. it uses the working directory set from step #4.\\Foo\Bar\
.
There is four ways to fix this, in decreasing order of preferred options.
InitialDirectory
for the dialog\\Foo\Bar
so that the user does not need to manually enter credentials to connect to it.Upvotes: 2
Reputation: 1215
Problem seems to be in setting the title bar of an Open/SaveFileDialog instance. Looks like there is a path that cannot be accessed by the this app. It could be a resource file that is used to set the title of this file dialog. Give the necessary directory and file permissions to the users.
Upvotes: 1
Reputation: 2870
Figure out what File I/O path it is trying to access in mainForm.vb, and give the relevant users the necessary directory permissions in this path.
Upvotes: 0