Okay so there are a lot of guides on this and most are completely right.
But what I want to show is slightly different, I want to give you the the BARE minimum page you can make with a ASPX page in SharePoint 2010.
1) Create a new blank SharePoint 2010 project targeting .net 3.5 framework and any processor and target your test SP2010 site
2) Add new reference to the SharePoint built in folder _Layouts
3) I recommend you create a sub folder in here to keep your custom files in nice and neatly, so make an External folder for this example
4) Add a new Application Page to the External folder and call it blanktest
5) Delete the designer page (not needed)
6) In the aspx page delete EVERYTHING but the following two lines:
<%@ Assembly Name=”$SharePoint.Project.AssemblyFullName$” %>
<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”blanktest.aspx.cs” Inherits=”Your.Namespace.Here” %>
8) Browse to your site http://[site]/_layouts/External/blanktest.aspx
There you have it, a 100% blank aspx page that you can do ANYTHING with.
This method is almost identical to making a ashx HTTP Handler, except instead of inheriting Page you Inherit HTTPHandler with your default function being:
public void ProcessRequest(HttpContext context).