In this blog we will know how to read a text
file in asp.net
First create a folder named as test in the application folder.In that test folder create a test.txt file.
Default.aspx code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!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 id="Head1" runat="server">
<title>Untitled
Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtMyFile" TextMode="MultiLine" Rows="10" Columns="60" Runat="server" ForeColor="Red" /><br />
<asp:button ID="bt1" Text="ReadText File" Runat="server" />
<asp:Label ID="lb1"
Font-Bold="True" ForeColor="#FF9900" Runat="server" />
</div>
</form>
</body>
</html>