mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
add auxiliar httpresponse.Redirect(string url, [HttpStatusCode redirStatusCode = HttpStatusCode.Redirect])
This commit is contained in:
@@ -191,10 +191,24 @@ namespace OSHttpServer
|
||||
get { return m_cookies; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set response as a http redirect
|
||||
/// </summary>
|
||||
/// <param name="url">redirection target url</param>
|
||||
/// <param name="redirStatusCode">the response Status, must be Found, Redirect, Moved,MovedPermanently,RedirectKeepVerb, RedirectMethod, TemporaryRedirect. Defaults to Redirect</param>
|
||||
public void Redirect(string url, HttpStatusCode redirStatusCode = HttpStatusCode.Redirect)
|
||||
{
|
||||
if (HeadersSent)
|
||||
throw new InvalidOperationException("Headers have already been sent.");
|
||||
|
||||
m_headers["Location"] = url;
|
||||
Status = redirStatusCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add another header to the document.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the header, case sensitive, use lower cases.</param>
|
||||
/// <param name="name">Name of the header, case sensitive.</param>
|
||||
/// <param name="value">Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n</param>
|
||||
/// <exception cref="InvalidOperationException">If headers already been sent.</exception>
|
||||
/// <exception cref="ArgumentException">If value conditions have not been met.</exception>
|
||||
|
||||
@@ -112,6 +112,13 @@ namespace OSHttpServer
|
||||
/// </summary>
|
||||
ResponseCookies Cookies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Set response as a http redirect
|
||||
/// </summary>
|
||||
/// <param name="url">redirection target url</param>
|
||||
/// <param name="redirStatusCode">the response Status, must be Found, Redirect, Moved,MovedPermanently,RedirectKeepVerb, RedirectMethod, TemporaryRedirect. Defaults to Redirect</param>
|
||||
void Redirect(string url, HttpStatusCode redirStatusCode = HttpStatusCode.Redirect);
|
||||
|
||||
/// <summary>
|
||||
/// Add another header to the document.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user