-
-
Save gdelca5/9d7fb9de02c25c250a7d to your computer and use it in GitHub Desktop.
Nancy RedirectResponse
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
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