Groups | Blog | Home
all groups > dotnet xml > july 2007 >

dotnet xml : FileStream and XmlTextReader Question


Mischa
7/26/2007 10:36:04 AM
It is my understanding that I can create an XmlTextReader from a variety of
sources, including a stream object. I am developing a web application that
reads some data from an Xml file. Everything works fine if I use the
XmlTextReader to open the file (i.e. pass it the file name):

Dim reader As XmlTextReader = New XmlTextReader("<file_name>")

But I get an access error if I try to open the file using a FileStream
object and then passing the FileStream object to the XmlTextReader
constructor:

Dim fs As FileStream = New FileStream("<file_name>", FileMode.Open)
Dim reader As XmlTextReader = New XmlTextReader(fs)

PS: assume that the file_name used has been properly mapped using
Server.MapPath

Martin Honnen
7/27/2007 12:00:00 AM
[quoted text, click to view]

What is the exact error you get? It is probably just an issue with
FileAccess and FileShare modes that you did not specify explicitly.


--

Martin Honnen --- MVP XML
Mischa
7/28/2007 12:26:04 PM
[quoted text, click to view]

AddThis Social Bookmark Button