<%@ 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)
    {

        string filename = Server.MapPath("TextFile.zip");

        System.IO.FileStream infile = System.IO.File.OpenRead(filename);
        System.IO.Compression.DeflateStream deflateStream = 
            new System.IO.Compression.DeflateStream(infile, 
                System.IO.Compression.CompressionMode.Decompress);
        byte[] buffer = new byte[infile.Length + 100];

        int offset = 0;
        int totalCount = 0;
        while (true)
        {
            int bytesRead = deflateStream.Read(buffer, offset, 100);
            if (bytesRead == 0) 
            { break; }

            offset += bytesRead;
            totalCount += bytesRead;
        }

        System.IO.FileStream outfile = 
            System.IO.File.Create(System.IO.Path.ChangeExtension(filename, "txt"));
        outfile.Write(buffer, 0, buffer.Length);
        outfile.Close();
    }
</script>