|
using System;
using MiniHttpd;
namespace MiniHttpdConsole
{
/// <summary>
/// Summary description for RedirectFile.
/// </summary>
[Serializable]
public class RedirectFile : IFile
{
public RedirectFile(string name, string redirect, IDirectory parent)
{
this.name = name;
this.redirect = redirect;
this.parent = parent;
}
string name;
string redirect;
IDirectory parent;
public string Redirect
{
get
{
return redirect;
}
}
#region IFile Members
public void OnFileRequested(HttpRequest request, IDirectory directory)
{
request.Response.ResponseCode = "302";
request.Response.SetHeader("Location", redirect);
}
public string ContentType
{
get
{
return null;
}
}
#endregion
#region IResource Members
public string Name
{
get
{
return name;
}
}
public IDirectory Parent
{
get
{
return parent;
}
}
#endregion
#region IDisposable Members
public void Dispose()
{
// TODO: Add RedirectFile.Dispose implementation
}
#endregion
public override string ToString()
{
return name;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here