AddHeader() 공개 메소드

Add another header to the document.
Adding any header will override the default ones and those specified by properties.
If headers already been sent. If value conditions have not been met.
public AddHeader ( string name, string value ) : void
name string Name of the header, case sensitive, use lower cases.
value string Header values can span over multiple lines as long as each line starts with a white space. New line chars should be \r\n
리턴 void
 /// <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;
 }
예제 #2
0
 /// <summary>
 /// Add a header field and content to the response.
 /// </summary>
 /// <param name="key">string containing the header field
 /// name</param>
 /// <param name="value">string containing the header field
 /// value</param>
 public void AddHeader(string key, string value)
 {
     _httpResponse.AddHeader(key, value);
 }