/// <summary>
/// Will request authentication.
/// </summary>
/// <remarks>
/// Sends respond to client, nothing else can be done with the response after this.
/// </remarks>
/// <param name="mod"></param>
/// <param name="request"></param>
/// <param name="response"></param>
protected virtual void RequestAuthentication(AuthenticationModule mod, HttpRequest request, HttpResponse response)
{
string theResponse = mod.CreateResponse(GetRealm(request));
response.AddHeader("www-authenticate", theResponse);
response.Reason = "Authentication required.";
response.Status = HttpStatusCode.Unauthorized;
}