First of all, I don’t know what the error you are talking about is. Aspx cannot be opened directly. It can be browsed through vs or run through iis .
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
The aspx file must have this line of declaration. So you first create an aspx file, and then replace the content after