File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -931,12 +931,22 @@ public void CopyFrom (HttpListenerResponse templateResponse)
931931 /// </exception>
932932 public void Redirect ( string url )
933933 {
934- checkDisposedOrHeadersSent ( ) ;
934+ if ( _disposed )
935+ throw new ObjectDisposedException ( GetType ( ) . ToString ( ) ) ;
936+
937+ if ( _headersSent ) {
938+ var msg = "The response is already being sent." ;
939+ throw new InvalidOperationException ( msg ) ;
940+ }
941+
935942 if ( url == null )
936943 throw new ArgumentNullException ( "url" ) ;
937944
938- Uri uri = null ;
939- if ( ! url . MaybeUri ( ) || ! Uri . TryCreate ( url , UriKind . Absolute , out uri ) )
945+ if ( ! url . MaybeUri ( ) )
946+ throw new ArgumentException ( "Not an absolute URL." , "url" ) ;
947+
948+ Uri uri ;
949+ if ( ! Uri . TryCreate ( url , UriKind . Absolute , out uri ) )
940950 throw new ArgumentException ( "Not an absolute URL." , "url" ) ;
941951
942952 _location = url ;
You can’t perform that action at this time.
0 commit comments