Redirection Event
Fires when the server suggests a redirect.
Syntax
public event OnRedirectionHandler OnRedirection; public delegate void OnRedirectionHandler(object sender, HttpclientRedirectionEventArgs e); public class HttpclientRedirectionEventArgs : EventArgs { public string OldURL { get; } public string NewURL { get; set; } public bool AllowRedirection { get; set; } }
Public Event OnRedirection As OnRedirectionHandler Public Delegate Sub OnRedirectionHandler(sender As Object, e As HttpclientRedirectionEventArgs) Public Class HttpclientRedirectionEventArgs Inherits EventArgs Public ReadOnly Property OldURL As String Public Property NewURL As String Public Property AllowRedirection As Boolean End Class
Remarks
This event is fired when the server suggests a redirection request (typically via a 301 or 302 response). OldURL indicates the 'from' page, and NewURL indicates the 'to' one. The destination page can be altered by the application if needed. Use AllowRedirection to block undesirable redirects.
Generally, this is a notification event: the component handles redirections automatically. Use the MaxRedirections config property to limit the number of redirection hops.