2

파일 대화 상자를 열려고하지만 ShowDialog를 호출 할 때 예외가 발생합니다. 이 코드는 항상 정상적으로 작동하지만 Silverlight 4로 업그레이드하면 문제가 발생한다고 생각합니다.Silverlight 4로 업그레이드하면 System.Security.SecurityException이 발생합니다.

코드 :

var dlg = new OpenFileDialog { Filter = "CSV Files (*.csv)|*.csv" }; 

if (dlg.ShowDialog() == true) 

{ 
    Upload(dlg.File); 
} 

예외 :

Directory = 'dlg.File.Directory' threw an exception of type 'System.Security.SecurityException' 
{System.Security.SecurityException: File operation not permitted. Access to path file.csv' is denied. 
    at System.IO.FileSecurityState.EnsureState() 
    at System.IO.FileInfo.get_DirectoryName() 
    at System.IO.FileInfo.get_Directory() 
} 

것 같다 내가 올바른 파일 이름과 파일 크기 만 디렉토리에 대한 정보를 가지고 있기 때문에 키우면 문제가 디렉토리에 대한 옵션을 얻을 좋아하고 디렉토리 이름.

+0

혹시 해결 방법이 있습니까? –

답변

2

응용 프로그램을 디버깅하려는 경우이 보안 예외가 발생합니다. 디버깅하지 않고 실행하고이 오류가 계속 발생하는지 확인하십시오.

관련 문제