PostForm() public static méthode

Post a form
public static PostForm ( string postUrl, string userAgent, string contentType, string formData ) : HttpWebResponse,
postUrl string
userAgent string
contentType string
formData string
Résultat HttpWebResponse,
Exemple #1
0
  /// <summary>
  /// Post the data as a multipart form
  /// </summary>
 public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary<string, string> values)
 {
     string formDataBoundary = "---------------------------" + WebHelpers.RandomHexDigits(12);
     string contentType = "multipart/form-data; boundary=" + formDataBoundary;
     string formData = WebHelpers.MakeMultipartForm(values, formDataBoundary);
     return WebHelpers.PostForm(postUrl, userAgent, contentType, formData);
 }
    /// <summary>
    /// Post the data as a multipart form
    /// postParameters with a value of type byte[] will be passed in the form as a file, and value of type string will be
    /// passed as a name/value pair.
    /// </summary>
    public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary <string, object> postParameters)
    {
        string formDataBoundary = "-----------------------------28947758029299";
        string contentType      = "multipart/form-data; boundary=" + formDataBoundary;

        byte[] formData = WebHelpers.GetMultipartFormData(postParameters, formDataBoundary);
        return(WebHelpers.PostForm(postUrl, userAgent, contentType, formData));
    }
 /// <summary>
 /// Post the data as a multipart form
 /// </summary>
 public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary<string, string> values, string boundary)
 {
     string formData = WebHelpers.MakeMultipartForm(values, boundary);
     return WebHelpers.PostForm(postUrl, userAgent, "multipart/form-data; boundary=" + boundary, formData);
 }