HttpWebRequest Class

MSBuild Extension Pack

HttpWebRequest Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

GetResponse (Required: Url Optional: ContentType, Timeout, SkipSslCertificateValidation, Retries, RetryInterval, UseIntegratedAuthentication, UserName, UserPassword Output: Response, Status)

Post (Required: Url Optional: ContentType, Timeout, RequestContent, SkipSslCertificateValidation, Retries, RetryInterval, UseIntegratedAuthentication, UserName, UserPassword Output: Response, Status)

Remote Execution Support: NA

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.WebHttpWebRequest

Namespace: MSBuild.ExtensionPack.Web
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The HttpWebRequest type exposes the following members.

Constructors

  NameDescription
Public methodHttpWebRequest
Top
Properties

  NameDescription
Public propertyContentType
The content type of the request. By default, it is "application/x-www-form-urlencoded" (used for classic HTTP POST) for Post and null for GetResponse.
Public propertyRequestContent
The content of the request. For classic HTTP POST, format is several [key]=[value] separated by "&". Could be SOAP for example if ContentType is SOAP.
Public propertyResponse
Public propertyRetries
The number of times the request should be retried before failing.
Public propertyRetryInterval
The number of milliseconds between retry attempts. Default is 0.
Public propertySkipSslCertificateValidation
Set to true to accept all SSL certificates.
Public propertyStatus
Contains the StatusDescription for successful requests. Contains the Status when encountering a WebException.
Public propertyTimeout
Sets the number of milliseconds to wait before the request times out. The default value is 100,000 milliseconds (100 seconds).
Public propertyUrl
Sets the name of the AppPool. Required.
Public propertyUseIntegratedAuthentication
The number of milliseconds between retry attempts. Default is 0.
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <MSBuild.ExtensionPack.Web.HttpWebRequest TaskAction="GetResponse" Url="http://www.freetodev.com">
            <Output TaskParameter="Response" ItemName="ResponseDetail"/>
            <Output TaskParameter="Status" PropertyName="ResponseStatus"/>
        </MSBuild.ExtensionPack.Web.HttpWebRequest>
        <Message Text="Status: $(ResponseStatus)"/>
        <Message Text="StatusDescription: %(ResponseDetail.StatusDescription)"/>
        <Message Text="StatusCode: %(ResponseDetail.StatusCode)"/>
        <Message Text="CharacterSet: %(ResponseDetail.CharacterSet)"/>
        <Message Text="ProtocolVersion: %(ResponseDetail.ProtocolVersion)"/>
        <Message Text="ResponseUri: %(ResponseDetail.ResponseUri)"/>
        <Message Text="Server: %(ResponseDetail.Server)"/>
        <Message Text="ResponseText: %(ResponseDetail.ResponseText)"/>        
    </Target>
</Project>
See Also

Reference