Converted to C# and ASP.NET