Here, we see how to read data from an external source.
StreamReader class
StreamReader class is used to read data from a file. In this Blog we read some data from a text file in the web page. we create a object of StreamReader class. Read method is used to read character from input stream.
Now suppose we want to read 100 character from a file.
Example:
.ASPX code
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="countchar.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 171px">
<strong>
Character:</strong>
<div id="div1" runat ="server" >

Join the conversation! Your thoughts help the community grow.