Duplication of html generated from htmlwebresponse

Discussion in 'ASP .Net' started by msnews.microsoft.com, Mar 28, 2005.

  1. 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
    msnews.microsoft.com, Mar 28, 2005
    #1
    1. Advertising

  2. 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
    msnews.microsoft.com, Apr 5, 2005
    #2
    1. Advertising

  3. 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
    msnews.microsoft.com, Apr 5, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ll

    duplication?

    ll, Nov 9, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Rocky Moore
    Nov 9, 2003
  2. =?Utf-8?B?QWVkZW4gSmFtZXNvbg==?=

    Duplication Submission on NLB cluster

    =?Utf-8?B?QWVkZW4gSmFtZXNvbg==?=, Oct 3, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    418
    Trevor Benedict R
    Oct 4, 2005
  3. Tomer Ben-David

    Duplication in events mechanisms in java?

    Tomer Ben-David, Dec 21, 2003, in forum: Java
    Replies:
    5
    Views:
    502
    Tomer Ben-David
    Dec 22, 2003
  4. lallous

    duplication issue (newbie)

    lallous, Jan 26, 2004, in forum: Java
    Replies:
    5
    Views:
    829
    Karl von Laudermann
    Jan 27, 2004
  5. simon.alexandre
    Replies:
    3
    Views:
    659
    simon.alexandre
    Jan 11, 2005
Loading...

Share This Page