This project has moved and is read-only. For the latest updates, please go here.

System.Net.WebRequest Extension Methods

WebRequest.GetResponseSafe Method

A WebRequest extension method that gets the WebRequest response or the WebException response.


WebResponse GetResponseSafe(WebRequest @this)


The @this to act on.


 // Copyright (c) 2013 Jonathan Magnan (
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here:
 using System.Net;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 namespace ExtensionMethods.Examples
     public class System_Net_WebRequest_GetResponseSafe
         public void GetResponseSafe()
             // Type
             WebRequest @this = WebRequest.Create("");
             // Examples
             WebResponse value = @this.GetResponseSafe(); // return a response;
             // Unit Test

Last edited Nov 23, 2013 at 7:55 PM by Jonathan_Magnan, version 1