Update mainfile.cs

*refactored for use with asp.net applications