Skip to content

Instantly share code, notes, and snippets.

@evilz
Created October 24, 2016 12:10
Show Gist options
  • Save evilz/5727ccd42ca3ef81d3df12b45c1103b6 to your computer and use it in GitHub Desktop.
Save evilz/5727ccd42ca3ef81d3df12b45c1103b6 to your computer and use it in GitHub Desktop.
Handler to check Http status code
<%@ WebHandler Language="C#" Class="TestResponse" %>
using System;
using System.Web;
public class TestResponse : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var r = context.Response;
r.ContentType = "text/plain";
var raw = context.Request.QueryString.Get("code");
if (string.IsNullOrWhiteSpace(raw)) { raw = "200";}
var code = int.Parse(raw);
r.StatusCode = code;
r.Write("Whazaaaaaaaaaaa");
}
public bool IsReusable
{
get
{
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment