Search code examples
asp.netopen-sourcewebmatrix

Sanitizing an ASP.NET web site project for open source sharing purposes?


I am writing an article on creating a WebMatrix 3/ASP.NET web site that lives in the Azure cloud. I want to make sure that I have removed all information that needs to be kept private to my account from the project I am sharing. So far I have replaced my public and private ReCAPTCHA keys with with string constants. An example of a piece of information I am concerned about is the PublicKeyToken field in the Web.config file. Do I need to replace the key value in that file too? If so, how does the user rebuild/replace the value easily for their own purposes?

What other pieces of information or DLLs, etc. do I need to clean up before safely sharing the entire project in a compressed folder? (If there a another known way to safely share a WebMatrix 3/ASP.NET project please let me know.)


Solution

  • You're on the right track with hiding your ReCAPTCHA keys - a lot of people miss this step, and you want to make sure not to share these keys. The PublicKeyToken field in web.config is nothing to worry about. This is simply a hash of a public key that matches up to a private key used to sign assemblies used in your application - that key is likely the same across anyone who is using .NET, and is not something you should be concerned about :)

    Other bits of information you should make sure not to share:

    • Connection strings
    • Any Azure *.publishSettings file ( shouldn't be in your site, but I would make sure )
    • Any application keys used for auth (twitter, facebook, etc)

    In terms of how to share the site - why not upload it to CodePlex or GitHub? WebMatrix 3 has a bunch of built in goodies for working with Git, so that's probably the easiest way to share the code:

    http://www.microsoft.com/web/post/how-to-use-git-in-webmatrix

    Please make sure to share the site with us on twitter @webmatrix after you finish it!

    Happy Coding :)