Posts Tagged ‘aspx’

Building ASP.NET web pages without Visual Studio.NET

Tuesday, January 26th, 2010

Related to the previous post, we were tasked with adding pages to an existing third-party ASP.NET web application without having access to the site’s existing code-behind files.

Although a slightly unusual situation, after a little digging around we found that it was quite easy to create the additional pages and integrate them into the website without the usual creation of a web project in Visual Studio.NET.  Instead each web page was created manually, here’s what was required:

For each web page create two files…

page.aspx.cs

Simply create a class that inherits from System.Web.UI.Page.  This will be the class that represents the web page.

namespace MyNamespace {

public partial class _Default : System.Web.UI.Page
{

}

}

page.aspx

Include the following directive at the top of the aspx page (assuming the aspx file uses a C# code behind file)

<% @ Page Language=”C#” CodeFile=”page.aspx.cs” Inherits=”MyNamespace._Default” Debug=”true” %>