public void SendHttpStatusCode401()
{
Dictionary<string, string> responseHeader = new Dictionary<string, string>();
responseHeader.Add("WWW-Authenticate", "Negotiate");
try
{
lock (this.initialQueue)
{
lock (this.segmentQueue)
{
this.httpServerTransport.Send(
(int)HttpStatusCode.Unauthorized,
responseHeader,
null,
this.initialQueue.Count != 0 ? this.initialQueue.Peek() : this.segmentQueue.Peek(),
false);
}
}
}
catch (ObjectDisposedException e)
{
if (this.logger != null)
{
this.logger.AddWarning(
string.Format("Object disposed exception is catched, detailed information: {0}.", e.Message));
}
else
{
throw;
}
}
if (this.logger != null)
{
this.logger.AddDebug("Http status code 401 is sent successfully.");
}
lock (this.initialQueue)
{
lock (this.segmentQueue)
{
// Consume the http listener context after the response is sent.
this.initialQueue.Clear();
this.segmentQueue.Clear();
}
}
}