File Directory ASP.Net Tutorial

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.IO.Compression" %>


    protected void Page_Load(object sender, EventArgs e)
    {
        string filename = Server.MapPath("Data.txt");
        FileStream infile = File.OpenRead(filename);
        byte[] buffer = new byte[infile.Length];
        infile.Read(buffer, 0, buffer.Length);
        infile.Close();
        FileStream outfile = File.Create(Path.ChangeExtension(filename, "zip"));
        GZipStream gzipStream = new GZipStream(outfile, CompressionMode.Compress);
        gzipStream.Write(buffer, 0, buffer.Length);
        gzipStream.Close();
    }



    Untitled Page