Invoke URL Method
Imports System.Threading
Imports System.IO
Imports System.Web.Mail
Imports System.Configuration
Imports System.Net.Sockets
'Dim strUSR as String="http://hari/MRS/frmAlertMessage.aspx?&Message=@TX&Mobile=@MN"
Public sub sInvokeURL(ByVal strURL as String)
Dim strMobileNum as String="98569855882"
Dim strMSGText as String="Hi..This is Test Message"
If strURL.Length > 0 Then
strURL = Replace(strURL, "@MN", strMobileNum)
strURL = Replace(strURL, "@TX", strMSGText)
strURL = FormatSPString(strURL)
Try
Dim ObjHTTP As System.Net.WebRequest
ObjHTTP = Net.HttpWebRequest.Create(strURL)
ObjHTTP.Timeout = 20000
Dim Result As Net.WebResponse
Result = ObjHTTP.GetResponse()
WriteToEventLog("HTTP Invoked : ", AppName, EventLogEntryType.SuccessAudit)
Catch ex As Exception
WriteToEventLog("HTTP Invoke Failed: ", AppName, EventLogEntryType.SuccessAudit)
End Try
End If
End Sub
Public Function WriteToEventLog(ByVal Entry As String, Optional ByVal AppName As String = "VB.NET Application", Optional ByVal EventType As EventLogEntryType = EventLogEntryType.Information, Optional ByVal LogName As String = "Application") As Boolean
'Dim oFile As System.IO.File
Dim oWrite As System.IO.FileStream
If File.Exists(App_Path() + "\" + Format(Now, "yyMMdd") + ".log") = False Then
oWrite = File.Create(App_Path() + "\" + Format(Now, "yyMMdd") + ".log")
End If
oWrite = File.OpenWrite(App_Path() + "\" + Format(Now, "yyMMdd") + ".log")
Dim s As New StreamWriter(oWrite)
s.BaseStream.Seek(0, SeekOrigin.End)
s.WriteLine(Format(Now, "dd-MM-yyy HH:mm") & "," & Entry)
s.Close()
oWrite.Close()
End Function
Public Function App_Path() As String
Return System.AppDomain.CurrentDomain.BaseDirectory()
End Function