If you try to download .cs or .vb files from an IIS Server you will soon see the following error:
Server Error in '/' Application.
This type of page is not served.
if your file is located in a simple directory or
The page cannot be displayed
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
To solve this you first have to convert the directory into an application-directory.
To do so enter the "IIS Manager", right click the directory, select "Properties", go to the tab and click the "Create" Button. Then select the "Configuration" Button, browse to the appropriate extension and remove it (in this case the .cs extension). It will remove the extension registration for the given directory only.
If you now you try to download the file you probably get the following error:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
The reason behind this is, that there is no MIME type registered with .cs files and IIS does not know how to handle it.
So again open the "IIS Manager", but this time right click on the server itself. Now click the button "MIME Types", press the "New" button and enter ".cs" as extension and "text/plain" as MIME Type. Then restart the affected web site (Default Web Site in my case) by clicking its stop and start button.
Now you should be able to download .cs files.