Code Samples on GotDotNet

The code samples I demoed during my TechEd Middle-Tier apps with C# session have finally
been uploaded onto GotDotNet.  Each sample has a readme.txt file which should
give you more information for how to setup and run the samples. 

#1 – Basic Serialization

The first sample is a very basic sample which shows how to return objects
through web services, how to shape XML through attributes, and returning data through
a DataSet in a web service.

#2a – Binary Web Service

This sample shows how to return binary data, like an image, by using two
different techniques, Base64 encoding and Direct Internet Message Encapsulation (available
in WSE 1.0).  Because this sample can be might be difficult to explain,
I’ve added a pretty picture:

#2b – File Upload through a Binary Web Service

While ASP.NET made it much easier to upload files to a server when compared
to classic ASP, I always found it really annoying to have to upload one file at a
time.  To solve this, I created a web service that accepts an array of 
(custom) file objects, consisting of a file name and an array of bytes Base64
encoded.  This upload web service can now be used by a variety of clients including
Java applications for example.  To show the power of no-touch deployment, I used
a Windows control with a label. When you drag-and-drop files over the label, the
cursor changes to a “+” symbol, and if you release the mouse, the files
are sent as an array of objects and uploaded onto a directory on the web service all
at once.  I have a couple of thoughts on how I can improve this, including asynchronous
upload with a status bar, FTP upload, and a dynamic client/server tree-view, but I
just didn’t have time.  I’ve included an explaining what’s going on

#3 Windows Services

The first sample shows how to use the FileSystemWatcher class in a Windows
service to monitor a directory and log all file changes, renames, deletes into the
Event Log.  It also includes a Windows Service installer which shows how to install
a Windows Service.  The other sample shows how to start and stop a windows
service directly from a mobile device (cell phone, RIM, etc) through an ASP.NET
mobile web application. Relevant Resources:

#4 ASP.NET Cache in DAL

This sample shows how you can leverage the powerful features of the ASP.NET cache
directly in a middle tier Data Access Layer (DAL) by using the ASP.NET cache
API. The DAL has two methods, one which retrieves using ASP.NET cache and the other
without.  To exaggerate the speed differences, I also made both threads go to
sleep for 1000 milliseconds when they hit the database and ran simple ACT scripts
against both pages.  Relevant Resources:

That’s all for now, enjoy 🙂

Comments (7)

  1. Ron Green says:

    I just have to ask. What did you use to create the graphics? It is very cool.

  2. Actually I didn’t create the graphics, Microsoft’s internal design team did, as much as I might like to take credit 🙂 You’ll notice that we recently standardized certain images, so whenever you see the triangle symbol, you’ll know that it represents an XML Web service. I actually used Powerpoint to piece together the different graphics as all the images were native Powerpoint objects, and just exported the slide from there.

  3. lewis says:

    very good stuff sunbeam

  4. lewis says:

    very good stuff sunroach

  5. SDSimonsen says:

    Hi there

    Your link to Demo #2b points to Demo #1a

  6. Hey SD,

    I tried the link to Demo #2b and it points to demo #2a, not #1. Since both of those demos are about uploading binary data through a web service, I packaged them up into the same code sample.

  7. SDSimonsen says:

    HI DF

    I have found the dragdrop folder in the WS_binary_webclient folder, but I do not seem to get the <OBJECT id="uploadcontrol" classid="http://localhost/ws_binary_webclient/FileDragAndDrop.dll#FileDragAndDrop.UploadControl&quot; width="400" height="150" VIEWASTEXT> in the uploadimages.aspx to show up.

    I have tryed the different FileDragAndDrop.dll’s and I have tryed to reecompile the FileDragAndDrop project and use the updatet dll, but this still does not work.

    Is there somthing missing from the testgroundproject that is not included in the download?

    I am wery interested in your approch of uploading multiple files 🙂