commit 162043565cb848047e68a55ab52f4e3189c9d768 Author: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sat Jun 5 14:34:09 2010 +0000 trunk+branch+tag svn structure diff --git a/FLocal.sln b/FLocal.sln new file mode 100644 index 0000000..5ce4c82 --- /dev/null +++ b/FLocal.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C# Express 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IISMainHandler", "IISMainHandler\IISMainHandler.csproj", "{9A902732-E7F1-4F41-869B-316AF2254B36}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9A902732-E7F1-4F41-869B-316AF2254B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A902732-E7F1-4F41-869B-316AF2254B36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A902732-E7F1-4F41-869B-316AF2254B36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A902732-E7F1-4F41-869B-316AF2254B36}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/IISMainHandler/Extensions.cs b/IISMainHandler/Extensions.cs new file mode 100644 index 0000000..bd7a178 --- /dev/null +++ b/IISMainHandler/Extensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace FLocal.IISHandler { + static class Extensions { + + public static void WriteLine(this HttpResponse response, string toWrite) { + response.Write(toWrite); + response.Write((char)0x0d); + response.Write((char)0x0a); + } + + } +} diff --git a/IISMainHandler/HandlersFactory.cs b/IISMainHandler/HandlersFactory.cs new file mode 100644 index 0000000..681d7b9 --- /dev/null +++ b/IISMainHandler/HandlersFactory.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace FLocal.IISHandler { + class HandlersFactory { + + public static ISpecificHandler getHandler(HttpContext context) { + //return new handlers.DebugHandler(context); + return new handlers.WrongUrlHandler(); + } + + } +} diff --git a/IISMainHandler/IISMainHandler.csproj b/IISMainHandler/IISMainHandler.csproj new file mode 100644 index 0000000..5d66cf7 --- /dev/null +++ b/IISMainHandler/IISMainHandler.csproj @@ -0,0 +1,68 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {9A902732-E7F1-4F41-869B-316AF2254B36} + Library + Properties + FLocal.IISHandler + IISMainHandler + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + 3.5 + + + + 3.5 + + + 3.5 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IISMainHandler/ISpecificHandler.cs b/IISMainHandler/ISpecificHandler.cs new file mode 100644 index 0000000..6d31272 --- /dev/null +++ b/IISMainHandler/ISpecificHandler.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace FLocal.IISHandler { + interface ISpecificHandler : IDisposable { + + void Handle(); + + } +} diff --git a/IISMainHandler/MainHandler.cs b/IISMainHandler/MainHandler.cs new file mode 100644 index 0000000..94e3f21 --- /dev/null +++ b/IISMainHandler/MainHandler.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace FLocal.IISHandler { + public class MainHandler : IHttpHandler { + + public bool IsReusable { + get { return true; } + } + + public void ProcessRequest(HttpContext context) { + using(ISpecificHandler handler = HandlersFactory.getHandler(context)) { + handler.Handle(); + } + } + + } +} diff --git a/IISMainHandler/Properties/AssemblyInfo.cs b/IISMainHandler/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a8f4f02 --- /dev/null +++ b/IISMainHandler/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("IISMainHandler")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("IISMainHandler")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("45db69c9-127c-4cb7-98ea-da4e4eb6d3a7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/IISMainHandler/handlers/DebugHandler.cs b/IISMainHandler/handlers/DebugHandler.cs new file mode 100644 index 0000000..6bcd30b --- /dev/null +++ b/IISMainHandler/handlers/DebugHandler.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace FLocal.IISHandler.handlers { + class DebugHandler : ISpecificHandler { + + private HttpContext context; + + public DebugHandler(HttpContext context) { + this.context = context; + } + + public void Handle() { + context.Response.ContentType = "text/plain"; + context.Response.WriteLine("Path: " + context.Request.Path); + context.Response.WriteLine("PathInfo: " + context.Request.PathInfo); + } + + public void Dispose() { + this.context = null; + } + + } +} diff --git a/IISMainHandler/handlers/WrongUrlHandler.cs b/IISMainHandler/handlers/WrongUrlHandler.cs new file mode 100644 index 0000000..f2393bc --- /dev/null +++ b/IISMainHandler/handlers/WrongUrlHandler.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; + +namespace FLocal.IISHandler.handlers { + class WrongUrlHandler : ISpecificHandler { + + public void Handle() { + throw new HttpException(404, "page not found"); + } + + public void Dispose() { } + + } +}