CAD System Web Site - Computer Aided Design Software
i NET1000.COM
by Makoto Honda





The .NET 2010 Note

                                               Return to   C# / WPF Implementation        

 What Is the .NET Anyway?                                                                      

  .NET FRAMEWORK        Last Update: 2010-October-18

  .NET FRAMEWORK        Last Update: 2010-October-18

World-Wide Web


World-wide Web (WWW) began as a research project at CERN in Switzerland.

  .NET FRAMEWORK        Last Update: 2010-October-18

HTTP (Hyper-Text Transfer Protocol)


HTTP is the communication mechanism with which Web browsers (clients) talk to Websites (servers).
HTTP lies on top of TCP/IP as an application layer. HTTP's basic commands: GET, POST, HEAD, PUT, ...
Most HTTP request/response are represented as a Hypertext Markup Language (HTML) page. All browsers understand how to parse HTML language (and how to render).

  .NET FRAMEWORK        Last Update: 2010-October-18

Microsoft ASP.NET 4


The .NET platform facilitates the creation of Web applications (cf. desktop applications) using a technology named ASP.NET (p.1379). ASP.NET 4.0 is the most recent version of Microsoft HTTP request processing framework (for Web development). ASP.NET has become one of the most stable, feature-rich frameworks for managing HTTP requests.

Using HTML to write Web pages manually is a laborious process. Why not replacing static HTML content with sever-side programs: For instance, rather than writing the same page header repeatedly, you can call a program on a server that automatically generates the page banner every time it's called. The ASP.NET code still generates HTML.

1.  ASP.NET pages have an extension .aspx (rather than .htm or .html)
2.  Directives  <@ Page attribute="value">
3.  Form element  <form id="formname" runat="server">

ASP.NET Web sites are hosted on Microsoft Internet Information Services (IIS) Web server. The IIS Web server intercepts all ASP.NET requests (identified by .aspx file extension, as opposed to .htm or html) and passes the requests to ASP.NET for processing. 

Master pages are used to control the look and feel of the Web pages...

Server-side controls use more resources than client-side controls - Use plain HTML elements unless you plan to use server-side resource. (p.201)
Also, try to deliver functionality (event-process) in a client-side script rather than use server-side code (requires a round trip/postback to the server).  

When you run ASP.NET Web page, what is sent to the browser is different, often more complex, because the ASP.NET syntax is converted to HTML. In the case of simple HTML elements (such as labels and text boxes), ASP.NET syntax isn't much simpler than HTML. The real difference between HTML and ASP.NET shows up when more complex display structures are used, such as tables, or view state values are used. The view state values are converted in HTML as a long sequence of characters representing data stored on the page. 

  .NET FRAMEWORK        Last Update: 2010-October-18


Web Application GUI (Graphical User Interface)

1.   ASP.NET Web Controls  (p. 1429)
namespace: System.Web.UI.WebControls

2.   HTML Controls - Supports server-side event handling  (p. 1440)
namespace: System.Web.UI.HtmlControls

  .NET FRAMEWORK        Last Update: 2010-October-18

ASP.NET pages UI layouts

0.  ASP.NET Web Form Application
     --- HttpApplication object
     Presentation code ==> ASPX (markup file containing the bulk of the UI layout)
     Logic/behavior code ==>  C#, VB.NET or any .NET language

  .NET FRAMEWORK        Last Update: 2010-October-18

Windows Presentation Foundation (WPF)

WPF programming model uses XAML to define UI layout instructions

One of the major goals of WPF is to separate UI layout and code (code-behind) to handle the behavior. WPF layouts are defined by XAML (Extensible Application Markup Language). XAML is an XML dialect (originally designed to support WPF). The client receives WPF visual layout + accompanying code to download to the client computer to handle events on the client side. Silverlight is a reduced version of WPF...

Three ways to deploy WPF-based contents over the Web

1.  Loose XAML
     Presentation code ==> XAML  (markup file containing the bulk of the UI layout)
     Logic/behavior code ==> 

2.  XBAP
     --- Only for Windows OS, tricky to use
     Presentation code ==> XAML  (markup file containing the bulk of the UI layout)
     Logic/behavior code ==> 

3.  Silverlight
     --- Introduced to overcome XBAP obstacles (runs on Windows IE/Firefox, Mac/Safari)
     --- SIlverlight is a subset of the .NET Common Language Runtime (CLR) and WPF rendering technology running on the client (p. 515).
     --- Keep the global state in Application object (Application.xaml.cs)
     --- Compiles to XAP (in ClientBin/)
     Presentation code ==> XAML  (markup file containing the bulk of the UI layout)
     Logic/behavior code ==> C#, VB.NET or any .NET language
          (a code that implements functionality, like event-handling, to be run on the client)

  .NET FRAMEWORK        Last Update: 2010-October-18

ASP.NET page vs. HTML page

Mypage.aspx vs. Yourpage.html

Static page / HTML page (mypage.html) --- Use FrontPage
Dynamic page / ASP.NET page (mypage.aspx) --- Use Visual Studio 2010 (Visual Web desiner Express???.

Currently I have two websites. Both are HTML-page webs created/maintained by FrontPage web-hosted by Hostway.
My current plan is "linux". I need to change to "windows" plan to use ASP.NET pages...
I would like to move to ASP.NET pages, but I want to keep what I have right now (1000 pages) initially intact.

I should be able to test this idea completely in my development environment using VS IDE (without actually touching my existing html sites, for now).
Stay in Visual Studio IDE until it is stable and deployable. And then I have to notify my web hosting company to change my plan to support ASP.NET (my current Linux plan does not support it).

Change web hosting plan to support .Net website hosting - $20/month. My current Linux plan is $15/month.
This change will wipe out all my current web contents... (Hostway billing: 1-866-467-8929 / Technical: 1-800-397-2449)
So, o
nce this plan change is done, I have to re-publish the whole web contents (make sure to back up & I have the whole copy).
I can use FrontPage for this re-publication.
(No ASP page yet)
My website(s) should work the same as before. I am just using a different hosting plan.

In order to take advantage of all NET services (like ajax, WPF, Silverlight...) it is better to start with an ASP.NET website.
So, use VS2010 (Visual Web ? Express) and create a brand new ASP.NET website.

Default.aspx page is created. This is my default "home" page. (I could delete this if I wanted to.)  Use R-click "Set as start page" from Solution Explorer to change the home page.

The idea is to create a hypertext link to my old html home page. This way it should be the same as before. Once I get that done, I can play with my site adding new pages as I go through my learning curve....

Copy all I have in my existing site (html pages) to this new site. Just copy-paste the root folder of the current web from Windows Explorer to VS2010 Solution Explorer's project (drop it on the project name in the Solution Explorer) root node. This way the entire website is copied in one step. This is better than R-click "Add Existing item ... " from VS2010 Solution Explorer..  because it takes 1000 steps.

The current (FrontPage) link tags (a href="A01_HomePage/Download.htm") are relative, so when you copy the entire folder across you can still preserve the old site link.

Create a button (for instance) in the default.aspx home page and make a link to my old website's home. Use NavigateURL control and set the hyperlink into the root folder of my old website I just copied. To add a hyperlink, just add the Hyperlink control in the NAVIGATEURL property (hit F4 to see Properties) this is where you enter the destination of the link. You can also make the link into an image, etc have a look at the other properties available.

I just moved my index.htm to a lower folder (not at the Project root) and changed the name, and then created a link by setting NavigateUrl property of the hyperlink control. I tested by Start w/o debug and it worked!

USE VS (do not use FrontPage) - Deployment
You can use FrontPage, or any text editor, to make pages, but you would be well-advised to use Visual Studio.
You must abandon FrontPage! The difference between a static HTML page and an Active Server Page is quite large,

I learned "deployment" of ASP.NET website, so I think I know how to do it, but I cannot figure out how that integrates with the use of FrontPage.


  .NET FRAMEWORK        Last Update: 2010-October-18


Improve display performance (RIA)

Allows partial update of web.... UpdatePanel

  .NET FRAMEWORK        Last Update: 2010-October-18

Desktop Applications vs. Web Applications

Difference One

A web application involves two networked machines: one hosting the web site and the other viewing data within a web browser.

1.  A client machine launches a web browser (MS IE, Apple Safari, Firefox,...)
2.  An HTTP request is made to access a particular resource (a web page) on the remote server machine.
3.  The browser opens a socket connection (via port 80 for a nonsecure connection) and sends the HTTP request to the target site.
4.  The web server receives the incoming HTTP request and processes it to format a proper HTTP response.
5.  The client-side browser renders the returned HTML sent from the web server.   

Difference Two

Another aspect of web development that is fundamentally different from desktop programming is that HTTP is a "stateless" protocol. ASP.NET provides various means of handling states, such as session variables, cookies, the application cache as well as the ASP.NET profile management.

  .NET FRAMEWORK        Last Update: 2010-October-18

State Management

Web applications are different form desktop applications: HTTP is a stateless protocol. To get around this limitation of HTTP, Web frameworks such as ASP.NET provide many services for storing and retrieving data. Collectively this process is referred to as state management.  You can use the ASP.NET state management features to develop Web sites without much consideration for how state is actually managed. ASP.NET will service state management for you transparently.  (p.256)

ASP.NET offers both client-side and server-side state management. Generally, use the client-side state management for small amounts of short-lived information. Server-side is more secure and can store more information over longer time intervals.

Client-side choices:
1.  View state - stored on a ASP.NET Web page
2.  Hidden-field - HTML hidden field
3.  Cookies
4.  Query strings

Server-side choices:
1.  Application state - stored in server memory
2.  Session state - stored in server memory
3.  Database -

(A) Good only as long as the user is in session and Web application is running...

1.   ASP.NET View State (p.1476)
      EnableViewState = true / false 
      a) Populate a listbox (example) by HTML 
      b) Populate a listbox (example) by code-behind (C# language)

2.   ASP.NET State (p. 1487)
      Application State :  HttpApplicationState 
      Session State :  HttpSessionState
      (ASP.NET Session State Server, p 1500)

3.   Cache
      Application level (not user level)

4.   Cookies
      On user's machine

(B) Persist across sessions...

5.   ASP.NET Profile API
      APS.NET ships an out-of-the-box user profile management API & database

  .NET FRAMEWORK        Last Update: 2010-October-18

.NET Framework

- Microsoft's current offering within the landscape of software engineering: the NET 4.0 platform.
- The .NET Framework is a software platform to build systems on Windows, Mac OS X, Unix/Linux...
- Microsoft's .NET Framework comprises the CLR (Common Language Runtime) plus .NET libraries that support applications targeting the CLR.

Motivation behind the genesis of Microsoft's .NET platform is to address the following "historical" difficulties:

        C (Old language, not object-oriented)
        C++ (Object-oriented but complex)
        MFC (provided support classes for Windows API... the fact remained C++ programming is difficult)
        Java (platform-independent, but little support for cross-language)
        COM (very successful object model, but plumbing under the hood is extremely complex)

CLI (Common Language Infrastructure)

Common Language Infrastructure (CLI) is a specification for a virtual machine. The CLI is embodied in ECMA (European Computer Manufacturers Association) standard specification.

CLR (Common Language Runtime) / CIL (Common Intermediate Language)

Common Language Runtime (CLR) is the Microsoft's implementation of CLI. (Any other manufacturers can implement it.)
All compilers for the languages (C#, C++, VB.NET, ...) that target .NET CLR convert the source code into CIL (Common Intermediate Language).
In the CLR virtual machine, when the assembly (*.dll or *.exe) is executed, it's compiled (on the fly) a second time from CIL to the native code just before the execution, using JIT (just-in-time) compiler, or Jitter.

C# language

Given that .NET is such a radical departure from previous Windows technologies, Microsoft crafted a new language specifically for this platform - C#.
C# is a C-family of language, derived from C++/Java, with improvements ...


  .NET FRAMEWORK        Last Update: 2010-October-18

FLASH --- Competing Web Technology from Adobe

TECHNOLOGIES - Flash, ActionScript 4, Flex, Papervision 3D

1.  RIA (Rich Internet Applications)


  .NET FRAMEWORK        Last Update: 2010-October-18

I created a Windows-based CAD system. I would like to convert this "desktop application" to a "Web-based system".  I do not know exactly what it means yet....

1)  Desktop Application  ---  this is what I have


1.  WIndows-based (MFC/MDI) runs on Windows
2.  C++ language
3.  OpenGL rendering

2)  Web-Application  ---  this is what I want to convert to


1.  Web-application targeting .NET framework.
2.  Managed code (not unmanaged) - supports Windows (IE/Firefox), Linux and Mac (Safari)
3.  C# language / XML
4.  Direct X or OpenTK (OpenGL wrapper) for 3D rendering
5.  Windows Presentation Foundation (WPF) / XAML (Extensible Application Markup Language)
6.  Silverlight (a delivery mechanism for WPF)
7.  ASP.NET / MVC (Model/View/Control - ?)
8.  Client/Server model / WCF (Windows Communication Foundation)
9.  RIA (Rich Internet Application) by WPF/Silverlight
10. APS.NET supports "session" state and "client" state.
11. MS Internet Information Services (IIS) server support.


I am just thinking out loud here...

A very simple, CAD system - just a proof of concept.
This is a Web-based CAD system (running on .NET framework/CLR virtual machine).

1.  Type a in your favorite browser (fake address).
2.  CAD desktop appears on your screen. There are two buttons on this CAD: a) CreateLine and b) ShortenLine.
3.  Click button a) and start Line Creation mode.
4.  You click (or key in x,y,z) to specify a 3D point and a point is created on the screen. This is created in 3D space. Click several times and then END it.
5.  You have created a multi-segmented line on the screen. Make another multi-line. The line creation is done on the CLIENT side.
6.  These lines must persist. Where? --- Maybe on the client machine.
7.  You can use the mouse to move the view (moving the viewport camera) in 3D. This is done on the client side.
8.  Now, click button b) and start Line Shorten mode.
9.  Here, you can click/pick (hit test) an existing multi-line.  At each click, one segment of the line is deleted, until only one left.
10. This process must be done on the SERVER side -  because I decided so.
11. The model was changed and the result must persist. If you come back tomorrow, you can pick up where you left off.
12. That's all.