Javascript converted to C# in Controller, fixed a few redirects