Redirecting to another server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gvi
    New Member
    • Mar 2007
    • 9

    Redirecting to another server

    Hi,

    I have the following requirement wherein I have a webform with webcontrols in it . While the original requirement is to database operations with it the new requirement is to along with inserting in db the webform's html needs to be sent to a different server.

    The new requirement needs me to send the webforms resulting html to be sent to a different webserver(essen tially a https:// web site).

    Right now I have the page output(HTML) as a stirng but not sure to redirect to another server because when I use the following code: the control goes to the other server(obviousl y) but I need the control back to the current site to do some operations like displaying message to user etc.

    Dim hRequest As HttpWebRequest = WebRequest.Crea te(sHtmlString)
    hRequest .Method = "POST"
    hRequest .ContentType = "applicatio n/x-www-form-urlencoded"
    Dim sRequestStream As Stream = hRequest .GetRequestStre am()
    Dim postBytes As Byte()
    Dim e As New System.Text.ASC IIEncoding
    postBytes = e.GetBytes(sHtm lString

    sRequestStream. Write(postBytes , 0, postBytes.Lengt h)
    sRequestStream. Close()

    HttpContext.Cur rent.Response.R edirect(URL, True)

    Can anybody advise me to do how to go about it



    Thanks in advance
  • gvi
    New Member
    • Mar 2007
    • 9

    #2
    Hi,

    I have the following requirement wherein I have a webform with webcontrols in it . While the original requirement is to database operations with it the new requirement is to along with inserting in db the webform's html needs to be sent to a different server.

    The new requirement needs me to send the webforms resulting html to be sent to a different webserver(essen tially a https:// web site).

    Right now I have the page output(HTML) as a stirng but not sure to redirect to another server because when I use the following code: the control goes to the other server(obviousl y) but I need the control back to the current site to do some operations like displaying message to user etc.

    Dim hRequest As HttpWebRequest = WebRequest.Crea te(URL)
    hRequest .Method = "POST"
    hRequest .ContentType = "applicatio n/x-www-form-urlencoded"
    Dim sRequestStream As Stream = hRequest .GetRequestStre am()
    Dim postBytes As Byte()
    Dim e As New System.Text.ASC IIEncoding
    postBytes = e.GetBytes(sHtm lString

    sRequestStream. Write(postBytes , 0, postBytes.Lengt h)
    sRequestStream. Close()

    HttpContext.Cur rent.Response.R edirect(URL, True)

    Can anybody advise me to do how to go about it



    Thanks in advance

    Comment

    Working...