Use FileStream to read file (VB.net) : FileStream « File Directory « ASP.NET Tutorial






<%@ Import Namespace="System.IO" %>
<script language="VB" runat="server">
   sub Page_Load(Sender as Object, e as EventArgs)
      dim fs as new FileStream(Server.MapPath("Default.aspx"), FileMode.Open, FileAccess.Read)
      dim objReader as new StreamReader(fs)
      
      while objReader.Peek() > -1
         Response.Write(Server.HTMLEncode _
            (objReader.ReadLine) & "<br>")
      end while
      objReader.Close
      fs.close
      
   end sub
</script>

<html><body>
</body></html>








10.14.FileStream
10.14.1.Using a FileStream to read a system file (C#)
10.14.2.Using a FileStream to read a system file (VB)
10.14.3.Use FileStream to read file (VB.net)
10.14.4.Using I/O enumerations to control file behavior when writing a file (C#)
10.14.5.Using I/O enumerations to control file behavior when writing a file (VB)