By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,309 Members | 1,452 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,309 IT Pros & Developers. It's quick & easy.

Duplication of html generated from htmlwebresponse

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Nov 19 '05 #2

P: n/a
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

Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.