<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
    using (System.IO.FileStream fs =
        new System.IO.FileStream(Server.MapPath("PlikTekstowy.txt"), System.IO.FileMode.Open))
    {
        byte[] data = new byte[fs.Length];
        fs.Read(data, 0, (int)fs.Length);
        
        this.lblResult.Text = ASCIIEncoding.Default.GetString(data);
    }
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Odczyt pliku tekstowego</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label runat="server" ID="lblResult" />
    </div>
    </form>
</body>
</html>