M
msnews.microsoft.com
AOA
I am using httpwebrequst and httwebresponse classes in order to execute an
html page. The html generaed is then emailed.
My problem is that
I am calling the GenerateHtmlText() method which is using httpwebrequst and
httwebresponse classes
This method is called in a loop
In first iteration it goes well. But in second iteration the html generated
contains the html generated in first iteration and
the html generated in second iteration but it should contain only the html
generated in second iteration.
I couldn't find out why the html generated in first iteration is placed in
the start of the html which is being generated in
the second iteration
example
forexample if html generated in first iteration is <br>
and html that should be in second iteration is <h1>
But the html generated in second iteration is
<br>
<h1>
Below is my code
For ind = 0 To 1
Dim objmail As New mail
searchid = ind
message = ""
message = objmail.GenerateHtmlText("CompPath",
"listingalert.aspx?sid=" & searchid)
...
Next
and GenerateHtmlText() method is written below
Public Function GenerateHtmlText(ByVal strKey As String, ByVal strPageName
As String, Optional ByVal strComm As String ) As String
Dim strurl As String
'Dim response As HttpWebResponse
Dim response As HttpWebResponse
Dim req As HttpWebRequest
'Dim req As WebRequest
Dim sr As StreamReader
Dim MessageBody As String
Dim newStream As Stream
Dim ind As Integer
Dim data As Byte()
Dim strdata As String
Dim uri As System.Uri
strurl = ConfigurationSettings.AppSettings(strKey) &
strPageName
req = CType(System.Net.HttpWebRequest.Create(strurl),
HttpWebRequest)
response = CType(req.GetResponse, HttpWebResponse)
sr = New StreamReader(response.GetResponseStream())
MessageBody = sr.ReadToEnd()
sr.Close()
Return MessageBody
end function
I am using httpwebrequst and httwebresponse classes in order to execute an
html page. The html generaed is then emailed.
My problem is that
I am calling the GenerateHtmlText() method which is using httpwebrequst and
httwebresponse classes
This method is called in a loop
In first iteration it goes well. But in second iteration the html generated
contains the html generated in first iteration and
the html generated in second iteration but it should contain only the html
generated in second iteration.
I couldn't find out why the html generated in first iteration is placed in
the start of the html which is being generated in
the second iteration
example
forexample if html generated in first iteration is <br>
and html that should be in second iteration is <h1>
But the html generated in second iteration is
<br>
<h1>
Below is my code
For ind = 0 To 1
Dim objmail As New mail
searchid = ind
message = ""
message = objmail.GenerateHtmlText("CompPath",
"listingalert.aspx?sid=" & searchid)
...
Next
and GenerateHtmlText() method is written below
Public Function GenerateHtmlText(ByVal strKey As String, ByVal strPageName
As String, Optional ByVal strComm As String ) As String
Dim strurl As String
'Dim response As HttpWebResponse
Dim response As HttpWebResponse
Dim req As HttpWebRequest
'Dim req As WebRequest
Dim sr As StreamReader
Dim MessageBody As String
Dim newStream As Stream
Dim ind As Integer
Dim data As Byte()
Dim strdata As String
Dim uri As System.Uri
strurl = ConfigurationSettings.AppSettings(strKey) &
strPageName
req = CType(System.Net.HttpWebRequest.Create(strurl),
HttpWebRequest)
response = CType(req.GetResponse, HttpWebResponse)
sr = New StreamReader(response.GetResponseStream())
MessageBody = sr.ReadToEnd()
sr.Close()
Return MessageBody
end function