Click here to Skip to main content
12,954,856 members (63,106 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads


150 bookmarked
Posted 17 Feb 2004

A Simple protocol to view aspx pages without IIS implemented in C#

, 17 Feb 2004
Covers how to write a Pluggable Asyncrhonous Protocol using C# and provides a useful protocol to enable local execution of ASP.NET sites.
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;

namespace Protocol
	[System.Runtime.InteropServices.ComVisible(false)] public class ProtocolBase
		#region IInternetProtocol Members

		public void Resume()

		public void Terminate(uint dwOptions)

		public void Seek(_LARGE_INTEGER dlibMove, uint dwOrigin, out _ULARGE_INTEGER plibNewPosition)
			plibNewPosition = new _ULARGE_INTEGER ();

		public void LockRequest(uint dwOptions)

		public void UnlockRequest()

		public void Abort(int hrReason, uint dwOptions)

		public void Suspend()

		public void Continue(ref _tagPROTOCOLDATA pProtocolData)

		const int S_OK = 0;
		const int S_FALSE = 1;
		public UInt32 Read(System.IntPtr pv, uint cb, out uint pcbRead)
			pcbRead = (uint)Math.Min(cb, StreamBuffer.Length);
			pcbRead = (uint)Stream.Read(StreamBuffer, 0, (int)pcbRead);
			Marshal.Copy(StreamBuffer, 0, pv, (int)pcbRead);

			UInt32 response = (pcbRead == 0) ? (UInt32)S_FALSE : (UInt32)S_OK;
			return response;


		[ComRegisterFunction] private static void RegisterProtocol(Type t)

		[ComUnregisterFunction] private static void UnregisterProtocol(Type t)

		public static IHttpNegotiate GetHttpNegotiate(IInternetProtocolSink Sink)
			if ((Sink is IServiceProvider) == false)
				throw new Exception("Error ProtocolSink does not support IServiceProvider.");

			IServiceProvider Provider = (IServiceProvider)Sink;
			object obj_Negotiate = new object();
			Provider.QueryService(ref Guids.IID_IHttpNegotiate, ref Guids.IID_IHttpNegotiate, out obj_Negotiate);
			return (IHttpNegotiate)obj_Negotiate;

		public static BINDINFO GetBindInfo(IInternetBindInfo pOIBindInfo)
			BINDINFO BindInfo = new BINDINFO();
			BindInfo.cbSize = (UInt32)Marshal.SizeOf(typeof(BINDINFO));
			UInt32 AsyncFlag;
			pOIBindInfo.GetBindInfo(out AsyncFlag, ref BindInfo);
			return BindInfo;

		protected MemoryStream Stream = new MemoryStream(0x8000);
		protected byte[] StreamBuffer = new byte[0x8000];


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.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Andy Brummer
Software Developer (Senior) Standard Beagle Studios
United States United States
I co-founded Standard Beagle Studio, a software development consulting service in Austin Texas with my wife Cindy Brummer. We focus mostly on web projects, but have built some react native mobile apps, and even a windows screen saver or two.

I started my career back when ASP pages were state of the art, and IE3 was considered a web browser. I've worked with Microsoft technologies for most of that time, and have recently branched out into node, wordpress, and react native applications.

I'm a web developer, math and physics enthusiast, father of 2, and all around great guy. I live in Austin TX and love using technology to change people's lives for the better. When I manage scrape together some spare time, I build generative art at curvature of the mind.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 18 Feb 2004
Article Copyright 2004 by Andy Brummer
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid