The aspx page itself is very simple:
<%@ Page language="c#" Codebehind="DotfuscatorASP.aspx.cs" AutoEventWireup="false" Inherits="DotfuscatorASP.Sample" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Dotfuscator ASP.NET Sample</title> </HEAD> <body> <h1>Dotfuscator ASP.NET Sample</h1> <form id="SampleForm" method="post" runat="server"> <p>You are visitor number <asp:Label id="CountLabel" runat="server" /> to this site!</p> </form> </body> </HTML>
All of the application logic resides in the DotfuscatorASP.aspx.cs code-behind file. Note that the aspx page references the class "
DotfuscatorASP.Sample" and the field "
CountLabel". These items are defined in the code behind. Since the aspx page is not processed until required by the web-server at runtime, these symbols must remain intact in the compiled code-behind assembly. Since they cannot be renamed, special steps must be taken to ensure that Dotfuscator will exclude them.
The class "
DotfuscatorASP.Sample" has a static field, "
PageLoadCount" that is incremented each time the page is loaded. This value is what is displayed in the CountLabel field and can be seen by the end-user in the browser. Note that this value is not persisted and will reset to the default value of 0 when the assembly is re-loaded by the web server.