Advertisement
Advertisement
| 01.17.2008 at 09:43AM PST, ID: 23090913 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: |
code behind...
Imports Microsoft.VisualBasic
Imports System.Net
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates
Imports System.Web.Security
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim mypost As New XMLTest
Dim RESPONSE_TEXT As String = "<xml><set><callrequest_update><request>Call-Say-Time</request><request_id>xxxxxxx</request_id><orig_address>xxxxx</orig_address><request_address>xxxxxx</request_address><request_status>pending</request_status></callrequest_update></set><src></src></xml>"
TextBox1.Text = mypost.sendPost(RESPONSE_TEXT)
End Sub
End Class
Public Class XMLTest
Public Const URL_BASE = "https://sanvtest.vincomm.net/tac/SiPbxDomain?kind=subscriber_config"
Public Const RSP_USERNAME As String = "xxxxx"
Public Const RSP_PASSWORD As String = "xxxxx"
Public Const PRIVATE_KEY = "Enter Private Key"
Public Function sendPost(ByVal str As String)
Dim myHttpWebRequest As New System.Net.WebClient
Dim rs As String = ""
Dim myCache As New CredentialCache
myCache.Add(New Uri(URL_BASE), "Basic", New NetworkCredential(RSP_USERNAME, RSP_PASSWORD))
myHttpWebRequest.Credentials = myCache
System.Net.ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate)
myHttpWebRequest.Headers.Add("Content-Type", "text/xml")
Try
Dim sendData As Byte() = System.Text.Encoding.ASCII.GetBytes(str)
Dim myHttpResponse As Byte() = myHttpWebRequest.UploadData(URL_BASE, "POST", sendData)
rs = System.Text.Encoding.ASCII.GetString(myHttpResponse)
Catch ex As Exception
rs = "err:" + rs
End Try
Return rs
End Function
'Used to convert to MD5
Public Function cMD5(ByVal str As String) As String
'Must have Imports System.Web.Security in General Declarations
Dim Hash As String = FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5")
Return Hash.ToLower
End Function
Public Shared Function ValidateServerCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
Return True
End Function
End Class
|