In a project I am running I need to compile this code into a DLL:
// svgzHandler.cs
using System;
using System.Web;
namespace svgzHandler
{
public class svgzHandler : IHttpHandler
{
#region IHttpHandler メンバー
public bool IsReusable { get { return true; } }
public void ProcessRequest(HttpContext context)
{
HttpResponse r = context.Response;
r.ContentType = "image/svg+xml";
r.AppendHeader("Content-Encoding", "gzip");
r.WriteFile(context.Request.PhysicalPath);
}
#endregion
}
}
Only I am no programmer and have NO IDEA WHAT THIS ALL MEANS. Also, what should the japanese characters be replaced by? is it a folder? a file?
I have Visual Studio 2010 Ultimate so I do have the compiler but This is the first bit of C# code i’ve ever touched.
thank you for your help!
P.S: I don’t know if this will help but this is the site with the instructions (translated from japanese): http://www.microsofttranslator.com/bv.aspx?ref=Internal&from=&to=en&a=http://blog.wonderrabbitproject.net/post/2009/06/13/svgze381aee3838fe383b3e38388e383a9e38292IIS75e381a6.aspx
The Japanese characters are inside a section name which is ignored by the compiler. You could completely get rid of the lines
#regionand#endregionif they bother you. It’s a Visual Studio thing to organize code, the compiler doesn’t use them. So to compile to an assembly, simply create a new project in visual studio of type Class Library and add this class to it. You will have to reference theSystem.Webassembly in order to successfully compile as the IHttpHandler interface that is used in this code is defined there.So the actual code could be simply (
svgzHandler.cs):And by the way you don’t even need Visual Studio in order to compile. You could directly use a C# compiler:
which would spit a
svgzHandler.dllassembly.