How to zip a file or a folder in ASP.NET

You can zip a file or a folder in ASP.NET by using, ICSharpCode.SharpZipLib.Zip or other library assemblies.

SharpZipLib can be downloaded from:

The ASP.NET examples below demonstrate how to zip files.

using ICSharpCode.SharpZipLib.Zip;
using System.IO;

ZipOutputStream zos = null;
protected void Button1_Click(object sender, EventArgs e)
string[] pathCollection = new string[2];
PathCellction[0] = “c:\\folder1”;

Learn more

How to learn ASP.NET

You can learn ASP.NET at You can learn the basics of ASP.NET first, then to watch some videos, you can also try some quick examples.

To learn more about data-access in ASP.NET you could visit This is an important part of learning ASP.NET.

You could also read some of the best ASP.NET books at TutorialsASP.NET Custom …

Learn more

How to replace \n line breaks with HTML <br /> line breaks in GridView

This is very common scenario when you would like to show well formatted GridView content. To do this you could use the ItemTemplate which is used by default to render the cell for each row:

<%# ((string)Eval(“GridviewContent”)).Replace(“\n”, “<br />”) %>

Related TutorialsHow to add a Web reference with Visual Studio 2010
How to connect to MySQL database using ASP.NET hosting
How to …

Learn more

How to Install ASP.NET MVC using ASP.NET hosting


ASP.NET MVC provides a Model-View-Controller (MVC) framework for developing Web applications using Visual Studio. ASP.NET MVC also includes ASP.NET Web API, ASP.NET Web Pages, Web Optimization and NuGet, a free, open source developer focused package management system.

How to install ASP.NET MVC

ASP.NET MVC can be installed from the ASP.NET MVC home page ( using the Web Platform …

Learn more

How to make the TextBox readonly or disabled in ASP.NET

You can make the TextBox control readonly by setting its ReadOnly property to true. You can set this property in the .aspx page which contains the TextBox control, or programmatically from the code-behind. The next test .aspx page shows this:


<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”ReadOnlyTextBox.aspx.cs”

Inherits=”TextBoxSamplesVC.ReadOnlyTextBox” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

Learn more

How to render a password type textbox in ASP.NET

You can render the TextBox control to as password type by setting its TextMode property to Password. The next test .aspx page shows this:


<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TextBoxAsPassword.aspx.vb”

Inherits=”TextBoxSamplesVB.TextBoxAsPassword” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

<html xmlns=””>

<head runat=”server”>

<title>Password type TextBox</title>



<form …

Learn more

How to write encoded text on the web page in ASP.NET

When you want to write encoded text on the web page you should use the Literal control, because it does support a property that is not supported by the Label control: the Mode property. The property enables you to encode HTML content and accept any of the following three values:

–  PassThrough—Displays the contents …

Learn more

How to associate a Label with a TextBox or other Form control in ASP.NET

The next code shows how you can attach an asp:Label control with the asp:TextBox. In this case when the user clicks the Label the application will focus on the TextBox.



<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TestAssociate.aspx.vb” Inherits=”TextChange.TestAssociate” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

<html xmlns=””>

<head runat=”server”>

<title>Associate a Label …

Learn more