Skip to content

Instantly share code, notes, and snippets.

@ahall
Created April 11, 2011 16:39
Show Gist options
  • Save ahall/913828 to your computer and use it in GitHub Desktop.
Save ahall/913828 to your computer and use it in GitHub Desktop.
[Route("/SendFile")]
public void SendFile(IManosContext ctx)
{
const string path = "/etc/services";
ctx.Response.Headers.SetNormalizedHeader("Content-Type", ManosMimeTypes.GetMimeType(path));
ctx.Response.SendFile(path);
ctx.Response.End();
}
$ curl -v http://localhost:5050/Blog/SendFile
* About to connect() to localhost port 5050 (#0)
* Trying ::1... Connection refused
* Trying fe80::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 5050 (#0)
> GET /Blog/SendFile HTTP/1.1
> User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
> Host: localhost:5050
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Transfer-Encoding: chunked
<
ahall 70005 122.1 0.4 649760 32628 s015 R+ 5:38pm 0:35.40 mono --debug Ahall.Web.exe runserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment