Microsoft Developer Network >
Domovská stránka fór
>
Windows Presentation Foundation (WPF)
>
How to give permission to folders?
How to give permission to folders?
- I'm trying to get an image from my disk. I was using the following code:
Dim img As New BitmapImage(New Uri(fileName, UriKind.Absolute))
book.Imagen.Source = img
fileName is a variable that contains something like: "E:/images//test.jpg"
(after a long headache, I found that "/t" means tab, so I have to use "//t"... I din't knew this for VB but for other languages)
Well, with an existing file, and a right string for it's name, this piece of code is telling me that the file doesn't exist:
>>......If System.IO.File.Exists(fileName) Then
>>.........Dim img As New BitmapImage(New Uri(fileName, UriKind.Absolute))
>>......End If
Just to be sure, I added some code to check wt...:
Dim myOpenFile As New OpenFileDialog
myOpenFile.ShowDialog()
Dim fileName As String
fileName = myOpenFile.FileName
HAHA -I said-, now VB.NET can't tell me that the file doesn't exists
Then I found that NET don't have permission to access that file and I get this exception: "System.Security.Permissions.FileIOPermission"
(In other words, the compiler could tell me that I don't have permission since the begining and don't force me to add code to guess what is happening. I knew the file was there). Something that I am not used to is the NET security model... How should I work on this?
Cheers,
Zameb
Odpovědi
- Well, it was not hard...
Application Properties>Security>Full trusted App
I think every developer wants to do a FULL trusted app... there are beter ways to control security
Thanks- Označen jako odpověďzameb 8. listopadu 2009 1:02
Všechny reakce
- I'm working with Windows Vista... I have been created a folder with All Users with full rights on that folder (Total Control, read, Write, Modify, Special), but NET still don't let me to select any file on that folder. I got the same exception: "System.Security.Permissions.FileIOPermission"
Comment... all that weird security only heads ppl to put their machines in a very insecure condition. Look, I'm trying to do something really simple and I had to give Total Control to ANYONE in one of my folders. It is not working too tho...
Any help? - Well, it was not hard...
Application Properties>Security>Full trusted App
I think every developer wants to do a FULL trusted app... there are beter ways to control security
Thanks- Označen jako odpověďzameb 8. listopadu 2009 1:02

