System.Net.HttpListenerResponse.Redirect C# (CSharp) Method

Redirect() public method

public Redirect ( string url ) : void
url string
return void
        public void Redirect(string url)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"url={url}");
            Headers[HttpResponseHeader.Location] = url;
            StatusCode = (int)HttpStatusCode.Redirect;
            StatusDescription = HttpStatusDescription.Get(StatusCode);
        }

Usage Example

Esempio n. 1
0
        public void authenticate(HttpListenerRequest req, HttpListenerResponse res, HTTPSession session)
        {
            // use the session object to store state between requests
            session["nonce"] = RandomString();
            session["state"] = RandomString();

            // TODO make authentication request

            // TODO insert the redirect URL
            string login_url = null;
            res.Redirect(login_url);
            res.Close();
        }
All Usage Examples Of System.Net.HttpListenerResponse::Redirect