|
-
Feb 20th, 2004, 02:30 PM
#1
Thread Starter
Lively Member
OpenFileDialog not populating textbox problem.
I'm puttint a program on my work's intranet that I would like everyone in my group to use. However I am running into a problem that doesn't seem to make sense.
The way it is supposed to work is that you click a browse button and it opens a OpenFileDialog box. You select the file you want and click on open. The path is then displayed in the textbox. Here is my code:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Try
TextBox1.Text = OpenFileDialog1.FileName
Catch ex As Exception
Console.WriteLine("The file cannot be read")
Console.WriteLine(ex.Message)
End Try
End If
End Sub
As long as the application is on my hard drive, it works fine. When I put the .exe on the network, the textbox stays blank.
So I tried another thing.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
TextBox1.Text = OpenFileDialog1.FileName
End Sub
Again, this works fine on my hard drive. When I put the .exe on the network, I get this error message:
The application attempted to perform an operation not allowed by the security policy. The operation required the SecuriyException. To grant this application the required permission please contact your system administrator, or use the Microsoft .NET security policy administration tool.
If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will be shut down immediately.
Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib,
PublicKeyToken=b77a5c561934e089 failed.
I have full control priveledges on this network drive. Any ideas on what gives?
-
Feb 21st, 2004, 02:35 AM
#2
Addicted Member
Hi,
Suppose that your EXE is in Computer #1 and you are trying to access the EXE from Computer #2 which is networked.
Go to Computer #2.
Start > Control Panel > Administrative Tools > Microsoft .NET Framework 1.1 Wizards.
Click Trust an Assembly
Follow the prompts and browse for the EXE which is in Computer #1.
Give full rights to the application.
You are done. 
Cheers,
McoreD.
-
Feb 23rd, 2004, 09:56 AM
#3
Thread Starter
Lively Member
I wish it were that easy. The network drive that I put the exe on is controlled by our network admin group. They are not to happy about stuff like that.
Is there anyway to set the rights prgrammatically?
-
Feb 25th, 2004, 10:56 PM
#4
Addicted Member
Well, you can go one step futhur by setting:
Start > Control Panel > Administrative Tools > Microsoft .NET Framework 1.1 Wizards.
Adjust .NET Security > Next > Local Intranet > Full Trust
This way, you will have to do it only once for every computer.
P.S: If it could have been done programmatically, then that would be overriding the security settings set by the target computer, hence a security threat. So I don't think that can be easily.
Last edited by ~*McoreD*~; Feb 25th, 2004 at 11:00 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|