Created
October 24, 2016 12:10
-
-
Save evilz/5727ccd42ca3ef81d3df12b45c1103b6 to your computer and use it in GitHub Desktop.
Handler to check Http status code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ 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