deebug

Network.Util.vb

Jul 12th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Collections.Specialized
  2.  
  3. Namespace Sitesource.Network
  4.     ''' <summary>
  5.    ''' Utility class
  6.    ''' </summary>
  7.    ''' <remarks></remarks>
  8.    Public Class Util
  9.         Public Const RequestMethodPOST As String = "POST"
  10.         Public Const RequestMethodGET As String = "GET"
  11.         Public Const FormContentType As String = "application/x-www-form-urlencoded"
  12.         ''' <summary>
  13.        ''' Creates a post string from the given parameters NameValueCollection.
  14.        ''' </summary>
  15.        ''' <param name="parameters">Post data.</param>
  16.        ''' <returns></returns>
  17.        ''' <remarks></remarks>
  18.        Public Shared Function GetPostString(ByVal parameters As NameValueCollection) As String
  19.             Return String.Join("&", Array.ConvertAll(parameters.AllKeys, New Converter(Of String, String)(Function(key As String) String.Format("{0}={1}", key, parameters.Item(key)))))
  20.         End Function
  21.     End Class
  22. End Namespace
Advertisement
Add Comment
Please, Sign In to add comment