Sample ASP.NET code that works in Cloud Sites

Uploading the following 3 files will result in a bare bones ASP.NET site that functions within Rackspace Cloud Sites. It would be possible to trim these down further, especially the web.config, however this is what I came up with through Visual Studio with minimal editing to the resultant files.

web.config:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?xml version=”1.0″?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug=”true” strict=”true” explicit=”true” />
<pages>
<namespaces>
<clear />
<add namespace=”System” />
<add namespace=”System.Collections” />
<add namespace=”System.Collections.Specialized” />
<add namespace=”System.Configuration” />
<add namespace=”System.Text” />
<add namespace=”System.Text.RegularExpressions” />
<add namespace=”System.Web” />
<add namespace=”System.Web.Caching” />
<add namespace=”System.Web.SessionState” />
<add namespace=”System.Web.Security” />
<add namespace=”System.Web.Profile” />
<add namespace=”System.Web.UI” />
<add namespace=”System.Web.UI.WebControls” />
<add namespace=”System.Web.UI.WebControls.WebParts” />
<add namespace=”System.Web.UI.HtmlControls” />
</namespaces>
</pages>
<authentication mode=”Windows” />
<customErrors mode=”Off”/>
</system.web>
</configuration>

Testing.aspx:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%@ Page Language="VB" AutoEventWireup="False" CodeFile="Testing.aspx.vb" Inherits="Testing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<title>Testing</title>
</head>
<body>
	<form id="form1" runat="server">
		<div>
			<asp:Label id="lbl1" runat="server" Text="Hello World"/>
		</div>
	</form>
</body>
</html>

Testing.aspx.vb:

1
2
3
4
5
6
7
8
9
10
11
12
'Option Explicit On
'Option Strict On
 
Imports System
Imports System.Web
Imports System.Web.UI
Partial Public Class Testing
	Inherits System.Web.UI.Page
	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		lbl1.Text="Hi World!"
	End Sub
End Class
Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
No Comments Posted in ASP.NET
Tagged , ,

Leave a Reply

*

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>