Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Passing Redirect via Headers

  • Loading branch information...
commit 8c583c4d94439fd7a6b81888dbbae7192f736993 1 parent 2cfa989
@GaryLCoxJr authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/FubuMVC.OwinHost/OwinHttpWriter.cs
View
4 src/FubuMVC.OwinHost/OwinHttpWriter.cs
@@ -48,7 +48,9 @@ public void Write(string content)
public void Redirect(string url)
{
// TODO: This is a hack, better way to accomplish this?
- _response.Write(string.Format("<html><head><meta HTTP-EQUIV='refresh' CONTENT='0;URL={0}' ></head><body /></html>", url));
+ _response.Status = Convert.ToString((int)HttpStatusCode.Redirect);
+ _response.Headers.Add("Location", url);
+ _response.Write(string.Format("<html><head><title>302 Found</title></head><body><h1>Found</h1><p>The document has moved <a href='{0}'>here</a>.</p></body></html>", url));
}
public void WriteResponseCode(HttpStatusCode status)
Please sign in to comment.
Something went wrong with that request. Please try again.