Thursday, July 31, 2008

Implementing a File Download in ASP.NET

Recently I gave some help to a colleague of mine implementing a file download. So I thought of sharing it with you.
If you need to make a web site user to download a file from your site you have to use HTTPResponse.Page.Response object. By using this you will be able to make the user download numerous kinds of files to their machines. The code required is as follows.

// This defines the type of the file that you are allowing to download.
Response.ContentType = "application/vnd.ms-excel";
// Path to the file to be downloaded.
string FilePath = MapPath("Xcel.xlsx");
// Initiating the file download.
Response.WriteFile(FilePath);
Response.End();

The above code will let the user download an Excel file named Xcel. Aprt from Excel you can use other file types as well by changin the Response.ContentType to the required file type.
A list of available content types are as follows.

Wednesday, July 16, 2008

SQL Server Native Client Cannot be Found

Recently when I try to install SQL Server 2005 I got the following error saying that Microsoft SQL Server Native Client cannot be found. A screen shot of the error is as follows.This error is due if the SQL Server Native Client is already installed using a different edition of SQL Server.
The resolution for this is to uninstall all the SQL related stuff (specially SQL Native Client) which are installed in the computer and try the SQL installation again after doing a system restart.

Wednesday, July 02, 2008

Creating a Crossover Cable

A crossover cable is a special cable we use when we needs to connect two computers together directly. But the thing is when creating the crossover cable you have to create it properly. As of the name suggests we have to cross some cables when clipping the network cable.

The following image will show how to do the cross.

If you have additional time you can visit the following site which is a good site explaining different color code standards.
http://www.patraswireless.net/tutorial/basic%20tutorial/tut-equipemt/cable_utp.htm

If you already have an existing network cable and if you would like to make it a crossover cable, the following site will be useful since there you can change the wires (by changing the color drop down controls) as it is clipped in one end and can find out the way the other end needs to be clipped.

http://www.davidj.org/tools/cabler/cabler.html