Click here to Skip to main content
15,894,100 members
Articles / Web Development / ASP.NET

Sending Files in Chunks with MTOM Web Services and .NET 2.0

Rate me:
Please Sign up or sign in to vote.
4.93/5 (177 votes)
23 Nov 2007CPOL15 min read 3.5M   12.5K   405  
How to send large files across web services in small chunks using MTOM (WSE 3)
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using MTOM_Library;
using System.ComponentModel;
using System.IO;
using System.Threading;

namespace UploadWinClient
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());			
        }
    }

	/// Console App Implementation...
	///	put the following in main: new Module1().Start();
	/// 
	/*class Module1
	{

		public void Start()
		{
			string[] arrfi = { "C:\\123.exe"};
			FileTransferUpload ftu = new FileTransferUpload();
			foreach(string fi in arrfi)
			{				
				ftu.LocalFilePath = fi;
				ftu.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ftu_RunWorkerCompleted);
				ftu.ProgressChanged += new ProgressChangedEventHandler(ftu_ProgressChanged);
				ftu.RunWorkerSync(new DoWorkEventArgs(0));
				Thread.Sleep(0);	// allow pending events to execute
			}
			Console.WriteLine("Finished");
		}

		void ftu_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
		{
			Console.WriteLine("ftu1_RunWorkerCompleted");
		}

		void ftu_ProgressChanged(object sender, ProgressChangedEventArgs e)
		{
			Console.WriteLine(e.ProgressPercentage.ToString() + "%");
		}
	}*/
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Ireland Ireland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions