How do I run this code

That code won´t run without visual studio since it have code that must be run on the server. The only thing you can do is copy the code between HTML tag and save it to an HTML file. That will run but since you have logic on your server side your upper case wont work.
Nevertheless, you can use some online tool like https://dotnetfiddle.net/

Leave a Comment