2010-07-13 4 views
0

현재 어떤 위치에서든 열 수있는 클라이언트 컴퓨터 (특정 위치 없음)에서 XML 파일을 읽으려고합니다. 그러나 폴더를 찾아 xml 파일을 선택하고이 줄을 실행하면 (아래) 경로 접근에 대해 불평하는 오류가 발생하여 어떤 방식으로 접근해야합니까?클라이언트 컴퓨터에서 XML 파일 읽기 - 점점 - 경로에 대한 액세스가 거부되었습니다.

오류 : System.UnauthorizedAccessException : 경로에 대한 액세스는 귀하의 코드는 서버에서 실행되고

Dim reader As New XmlTextReader(System.IO.Path.GetFullPath(File1.PostedFile.FileName)) 

      Dim m_xmlr As XmlTextReader 
      'Create the XML Reader 
      m_xmlr = New XmlTextReader(System.IO.Path.GetFullPath(File1.PostedFile.FileName.ToString())) 
      'Disable whitespace so that you don't have to read over whitespaces 
      m_xmlr.WhitespaceHandling = WhitespaceHandling.None 
      'read the xml declaration and advance to family tag 
      m_xmlr.Read() **<<<<<ERROR** 
      'read the family tag 
      m_xmlr.Read() 
      'Load the Loop 
      While Not m_xmlr.EOF 
       .............. 
       ............. 

답변

0

을 거부한다. 그런 식으로 클라이언트의 로컬 드라이브에서 읽을 수는 없습니다. 데이터를 얻으려면 파일의 InputStream을 사용해야합니다. 예 :

Dim m_xmlr As XmlReader = XmlReader.Create(File1.PostedFile.InputStream) 
관련 문제