Skip to content

Instantly share code, notes, and snippets.

@gdelca5
Created January 26, 2015 11:41
Show Gist options
  • Save gdelca5/9d7fb9de02c25c250a7d to your computer and use it in GitHub Desktop.
Save gdelca5/9d7fb9de02c25c250a7d to your computer and use it in GitHub Desktop.
Nancy RedirectResponse
using Nancy;
public class IndexModule : Nancy.NancyModule
{
public IndexModule()
{
Get["/"] = parameters =>
{
return new RedirectResponse("http://localhost:9000/");
};
}
}
public class RedirectResponse : Response
{
public RedirectResponse(string location)
{
this.Headers.Add("Location", location);
this.Contents = GetStringContents(string.Empty);
this.ContentType = "text/html";
this.StatusCode = HttpStatusCode.SeeOther;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment