Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CodeBank - A small centralized code repository built using the .NET framework.

0.00/5 (No votes)
20 Apr 2003 1  
A .NET web based code repository for storing, searching, browsing and administering categorized projects.

Introduction

After first discovering CodeProject and using it, I was yet again amazed at the value that such sites provide developers. Reviewing the site and its features reminded me of all the times I had wished that I had not made personal code folders. When we all do this, teams of developers seem to write duplicate versions of code, whether it be a string splitter or something much more complicated. Being a beginner to .NET development, I decided to write a simple code repository and host it on the my website, so that I can paste my code snippets in a location that I can always gain access to, and so CodeBank was born.

Configuration

First we need to ensure your machine meets the following prerequisites:

  • IIS is installed
  • SQL Server 2000 is installed
  • The .NET framework is installed
  • Any patches are installed with respect to the above 3 items.

Note that if you installed Visual Studio in order to debug on this machine, and the machine is a PDC (Domain Server) you will not be able to use the interactive debugging. Microsoft disabled this feature for security reasons.

When you have downloaded the zip file to a temporary location, you should have a directory labeled codebank. Please follow the tasks in order for the site to be operational.

  • Copy the CodeBank directory to your root web directory. e.g. d:\inetpub\wwwroot\codebank.
  • Create an IIS virtual directory for the following:
    • Codebank - virtual directory for CodeBank.
    • ProjectCaseStudies - virtual directory where case studies are uploaded for each project you create.
    • ProjectUploads - virtual directory where code files are uploaded for each project you create.
  • Ensure that IIS and ASPNET users have access to be able to write to projectcasestudies and projectuploads.
  • Set these shares to Everyone initially. When the application uploads correctly, you can adjust the security accordingly.
  • Start up SQL Server 2000 Enterprise manager and create a blank database named codebank
  • Right click the newly created database codebank and select to restore a database from backup.
  • Navigate to the codebank\sql directory and select the file named codebank.bak.
  • Click OK to restore
  • Navigate to the Web.Config file located in the root of codebank directory and make the appropriate changes to the <APPSETTINGS> entries

Web.config

In adherence with good coding standards, Microsoft recommends placing custom settings in the web.config file. I felt it was a relevant place for the database and other web settings. Please ensure that you change these according to your database username, password and respective file paths.

appSettings
  add key="CONNECTION_STRING" 
    value="server=servername or ip address;database=codebank;
                 user id=your username;password=your password" 
  add key="FILE_PATH" 
    value="x:\your web directory path\codebank\projectuploads\" 
  add key="FILE_VIRTUAL_DIRECTORY" 
    value="http://<your domain or machine name>/codebank/projectuploads/" 
  add key="CASE_PATH" 
     value="x:\<your web directory path>\codebank\projectcasestudies\" 
  add key="CASE_VIRTUAL_DIRECTORY" 
    value="http://<your domain or machine name>/codebank/projectcasestudies/" 
appSettings

Thanks

I would like to mention a thanks to CodeProject for inspiration and special thanks to my former colleague James Coleman for his direction.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here