FlushResponse() public method

public FlushResponse ( bool finalFlush ) : void
finalFlush bool
return void
Example #1
0
        static void Redirect(XSPWorkerRequest wr, string location)
        {
            string host = wr.GetKnownRequestHeader(HttpWorkerRequest.HeaderHost);

            wr.SendStatus(301, "Moved Permanently");
            wr.SendUnknownResponseHeader("Connection", "close");
            wr.SendUnknownResponseHeader("Date", DateTime.Now.ToUniversalTime().ToString("r"));
            wr.SendUnknownResponseHeader("Location", String.Format("http://{0}{1}", host, location));
            Encoding enc = Encoding.ASCII;

            wr.SendUnknownResponseHeader("Content-Type", "text/html; charset=" + enc.WebName);
            string content = String.Format(content301, host, location);

            byte [] contentBytes = enc.GetBytes(content);
            wr.SendUnknownResponseHeader("Content-Length", contentBytes.Length.ToString());
            wr.SendResponseFromMemory(contentBytes, contentBytes.Length);
            wr.FlushResponse(true);
            wr.CloseConnection();
        }
Example #2
0
 static void Redirect(XSPWorkerRequest wr, string location)
 {
     string host = wr.GetKnownRequestHeader (HttpWorkerRequest.HeaderHost);
     wr.SendStatus (301, "Moved Permanently");
     wr.SendUnknownResponseHeader ("Connection", "close");
     wr.SendUnknownResponseHeader ("Date", DateTime.Now.ToUniversalTime ().ToString ("r"));
     wr.SendUnknownResponseHeader ("Location", String.Format ("http://{0}{1}", host, location));
     Encoding enc = Encoding.ASCII;
     wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
     string content = String.Format (CONTENT301, host, location);
     byte [] contentBytes = enc.GetBytes (content);
     wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
     wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
     wr.FlushResponse (true);
     wr.CloseConnection ();
 }