Powered by FindinSite

Dynamic-CD.Net's support for ASP.NET

ASP.NET is supported by the Dynamic-CD.Net version of Dynamic-CD.
Please see the list of Dynamic-CD.Net features for an overview of this software.

  • Use Dynamic-CD-Wizard to take an existing source directory and create a new image.
  • If using a database, you will probably need to export the data into Access format, change your code to use System.Data.OleDb and set up a suitable database connection string.
  • If you wish to protect your source, consider compiling it into a DLL.
A CD AutoPlay dialog window that gives the user the option of running Dynamic-CD.Net

User systems


A Dynamic-CD.Net CD, DVD or USB-memory-device will attempt to AutoPlay when inserted into a user's Windows computer. If AutoPlay is turned off, the user can try double-clicking the drive icon in My Computer, or explore the drive and click StartTheCD.vbs (or dyncd/dyncd.exe). See the AutoPlay details page for full info.

Windows version check

Dynamic-CD.Net only runs on Windows XP, Windows Vista, Windows 7 (equivalent or later). If you try to run on a earlier version of Windows, Dynamic-CD displays a suitable error message and exits.

.NET version check

A Dynamic-CD warning that .NET 2.0 or later is required

Dynamic-CD.Net checks to see if .NET is installed, and the latest version installed. If .NET is not installed or the latest version is earlier than 2.0, then a suitable error message is displayed and Dynamic-CD exits.

If your site depends on a specific version of .NET/ASP.NET, you will need to add in code to check for this. (If this is something that you think should be provided in Dynamic-CD.Net then please get in contact.)

Firewall block

Windows may display a Security Alert saying that it had blocked some features of Dynamic-CD, ie its ability to communicate on private or public networks. Dynamic-CD.Net will continue to run fine whichever options are selected.

Other dependencies

Check carefully to see if your site has any software dependencies, ie software that your users must have installed. For example, if you are using Access 2007 database files (with .ACCDB extension) make sure you provide instructions for the user to download the relevant drivers if they need to - or provide the relevant installs on the CD.

Dynamic-CD.Net Web Server

Dynamic-CD.Net is a web server that runs locally, by default on port 8090, so it would typically respond at or http://localhost:8090/

Most served files and their HTTP headers are generated by the Microsoft ASP.NET engine. "Etag" and "If-None-Match" response and request HTTP headers are supported.

Password-protected files are served directly by Dynamic-CD.Net. "Last-Modified" and "If-Modified-Since" response and request HTTP headers are supported.

Directory listings are turned off by default. TO DO: provide an option to enable this.

The default file served for directory access is taken from the first file found in this list:

  • - default.htm
  • - default.html
  • - default.aspx
  • - index.htm
  • - index.html
  • - index.aspx

Various file types (eg .CONFIG) and files in various restricted directories are not served to the user (though they can be found by exploring the CD).

By default, access to Dynamic-CD.Net is only enabled on the local computer. However, a Dynamic-CD-Wizard option lets you enable access from other computers, both on your private network and from the wider public internet - though firewall rules may stop such accesses. It is best not to enable this option for CDs distributed to the public.

ASP.NET support

Dynamic-CD.Net builds on the standard ASP.NET engine provided by Microsoft, and is based on the Cassini web server 3.5 source code, available under the Microsoft Public License (Ms-PL). See also: CodePlex Cassini++.

In general, Dynamic-CD.Net supports all ASP.NET features, so User controls, HttpModules and HttpHandlers are supported, along with ViewState, Cookies and Session variables.

The web site runs within a single application domain at root level, eg

Dynamic-CD.Net has a platform target of x86 (32 bit) and will run on x86 and x64 (64 bit) systems. The reason for choosing a target of x86 is so that the Microsoft Jet driver for Access MDB database files works. If you need a version that targets Any CPU or x64 then please get in touch.

Using databases

  • If your data is in a SQL Server or other database, then you will probably want to export the required data into an Access database file, ie preferably MDB format, or the newer ACCDB format.
  • You will probably have to switch to use the System.Data.OleDb namespace.
  • Make sure that you do not hard code any connection strings, ie use Server.MapPath to find the path to an Access MDB or ACCDB database.

VB.NET Access MDB example

This example shows a VB routine to open an Access MDB file (using the Microsoft Jet driver) and display all columns in all rows - it is the Click handler for the ShowDb button, putting the results in the lblResults label.

Protected Sub ShowDb_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShowDb.Click

	Dim DbPath As String = Server.MapPath("~/MyDatabase.MDB")

	Dim connectionstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DbPath

	Dim adoCon As OleDbConnection = New OleDbConnection(connectionstring)

	Dim strSQL As String = "SELECT * FROM MyTable"

	Dim dbCmd As OleDbCommand = New OleDbCommand(strSQL, adoCon)
	Dim drCmd As OleDbDataReader = dbCmd.ExecuteReader()
	While drCmd.Read
		Dim i As Integer
		For i = 0 To drCmd.FieldCount - 1
			lblResults.Text &= HttpUtility.HtmlEncode(drCmd(i).ToString()) & " "
		Next i
		lblResults.Text &= "<br>"
	End While
	drCmd = Nothing
	adoCon = Nothing

End Sub

C# Access ACCDB example

This example shows a C# routine to open an Access ACCDB file (using the Microsoft ACE.OLEDB driver) and display all columns in all rows - it is the Click handler for the ShowDb button, putting the results in the lblResults label. This time, column name:value pairs are shown.

protected void ShowDb_Click(object sender, EventArgs e)
	string rv = null;
	string strSQL = "SELECT * FROM MyTable";
	rv = "<b>" + strSQL + "</b><br>";
	string DbPath = Server.MapPath("MyDatabase.accdb");
	string connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + DbPath + ";Persist Security Info=False;";
	using (OleDbConnection adoCon = new OleDbConnection(connectionstring))

		OleDbCommand dbCmd = new OleDbCommand(strSQL, adoCon);
		OleDbDataReader drCmd = dbCmd.ExecuteReader();
		while (drCmd.Read())
			for (int colno = 0; colno < drCmd.FieldCount; colno++)
				string ColName = drCmd.GetName(colno);
				string ColValue = drCmd[colno].ToString();
				rv += HttpUtility.HtmlEncode(ColName+":"+ColValue + " ");
			rv += "<br>";
	lblResults.Text = rv;


Protecting code and databases

Various file types (eg .CONFIG, .CS, .VB and others) and files in various restricted directories are not served to the user. However these files are easily visible directly on the CD. So do not put any sensitive information in these files, eg email account details or connection strings for online databases.

The above file types (and ASPX files and others) cannot currently be password-protected by Dynamic-CD-Wizard as the ASP.NET system needs direct access to these files.

One potential solution is to compile your codebehind files into a DLL to go in the bin directory. One option for doing this is to precompile your project (and merge the assemblies). Another option is to convert your web site to a Web Application Project. However .NET assembly DLLs can be reverse engineered; using a code obfuscator may make this task harder, though still not impossible.

Database files cannot currently be password-protected by Dynamic-CD-Wizard. You can add a password to Access database files but this is usually easily cracked. However this may provide a measure of protection against idle viewers. You will then have to ensure that your connection string contains the password, and ensure that your connection string is protected.

   Home     Purchase     Licenses     Limitations     Version details     Site map     Contact     Copyright © 2000-2016 phdcc
  Dynamic-CD : the web server on CD Learn more | What's new