I want to learn how to make a website with C#. I know PHP, but I like the C# language better. I have tried learning how to make a website in ASP.NET which so far has really frustrated me because I really don't like ASP at all (even less than I like PHP). Something about it drives me completely insane to the point where I am having a hard time forcing myself to learn it. Is there a way to just immediately transfer control away from ASP to C# and then do everything from C#, including outputting HTML and other stuff when necessary like you would in PHP? In other words I like the PHP way of website programming but prefer the C# language. Any help will be appreciated.
Take a look at asp.net mvc: http://www.asp.net/mvc/.
It's much closer to the metal than asp.net webforms and should feel more comfortable if you're coming from a PHP background.
There's lots of good tutorials here: http://www.asp.net/Learn/mvc/
Yes, you can use HttpHanders to handle all your requests. An HttpHandler is a class that can receive a request directly, and handle it all with code. It is often used to catch a request for an image, and serve it for a database, but you could certainly use it to do what you want.
Check out the MSDN introduction to using HttpHandlers. Please post a comment if you have any more questions about it.
ASP.NET MVC is another option, but that still uses ASPX markup by default. You could, potentially, find another view engine that you like more. I don't know anything about that, though. (edited - thanks Joel!)
Edit: Keep in mind that you are technically still within an ASP.NET project when using HttpHandlers, but that's just to get the Request/Response/Server Context/etc Framework running around you. You can still work 100% with C# code.
You can also use Generic Handlers (.ashx). These supply you with a httpcontext and it's completely up to you what you do with it.
"I really don't like ASP at all (even less than I like PHP)" followed by "I like the PHP way". It sounds like you're having trouble breaking with the old and have become somewhat conflicted.
I felt the same coming from classic asp to asp.net, and traditional asp.net sites still give me a lot of grief. When you're used to finer grained control, it can be hard to get your head round more "frameworkey" ways of doing things. As said before, give asp.net MVC a try. IMO it offers the right balance and for me is a breath of fresh air after Asp.net.
Just don't use any server-side control, put the code directly in the ASPX file (between <% and %>), and it should feel just like PHP (or classic ASP)... You could also do it with an HttpHandler, but in that case you will lose the ability to write inline HTML ; you would have to output all the markup using Response.Write, which isn't exactly convenient...
Note that I strongly advise against any of these approaches, that's just the answer to your question ;)
It's not a particularly good option, but you could use C# with CGI if you want to go the simple route.
You can do most things in ASP.net using fairly pure C#. Early on I relied heavily on the ASP.net controls, dragging and dropping most of my pages with little snippets of code here and there to make controls do what I wanted. I really didn't like it, and it make me think of coding ASP.net as a completely distinct thing from C# programming(Ok it was vb at the time- Don't Judge me!).
Now almost all of my code- and html generation is handled by various custom classes. My code-behind pages simply connect the page specific inputs and event to my utillity classes. Likewise i use inline code for output- I simply invoke a function on my code behind that gathers the necessary variable and lets my classes do the heavy lifting.
I definitely find that some of the ASP.net specific controls are useful and I do use them from time to time. I did, however, find that changing the way I put my code together gave me a whole different idea of the language.