I'm maintaining a VB.Net 1.0 web application which has been running fine for years, until recently. It seems an Http Post page is being submitted twice and sometimes more than twice!!
This is a lead generation system, so leads are posted to an external site. The application has code to block double submission, (it disables the back button and checks lead name) but somehow the double leads are still getting through.
Does anyone know how or why this could be happening? I've read a few blogs about an "IE" bug which sometimes causes this, but it didn't sound like the right answer here.
Here is the code:
Dim uriBase As String = "https://www.abc.com/eval.aspx"
Dim uri As New Uri(uriBase + "?" + uriParameters)
Dim webRequest As HttpWebRequest = HttpWebRequest.Create(uri)
webRequest.Method = "POST"
webRequest.ContentType = "application/x-www-form-urlencoded"
webRequest.KeepAlive = False
webRequest.AllowAutoRedirect = False
webRequest.ContentLength = uriParameters.Length
Dim writer As System.IO.StreamWriter = New System.IO.StreamWriter(webRequest.GetRequestStream())
writer.Write(uriParameters)
writer.Close()
'Read Values back
Dim webResponse As HttpWebResponse = webRequest.GetResponse()
Dim reader As StreamReader = New StreamReader(webResponse.GetResponseStream())
Dim str As String = reader.ReadToEnd()
reader.Close()
Any ideas? The code is pretty simple and looks ok, to me, but maybe I'm wrong??
daveg92656
0 Points
5 Posts
Http Post being submitted twice...
Aug 03, 2009 05:48 PM|LINK
hello,
I'm maintaining a VB.Net 1.0 web application which has been running fine for years, until recently. It seems an Http Post page is being submitted twice and sometimes more than twice!!
This is a lead generation system, so leads are posted to an external site. The application has code to block double submission, (it disables the back button and checks lead name) but somehow the double leads are still getting through.
Does anyone know how or why this could be happening? I've read a few blogs about an "IE" bug which sometimes causes this, but it didn't sound like the right answer here.
Here is the code:
Dim uriBase As String = "https://www.abc.com/eval.aspx"
uriParameters = usernameParam + username + passwordParam + password + firstNameParam + firstName + lastNameParam + lastName + leadIDParam + leadIDValue
Dim uri As New Uri(uriBase + "?" + uriParameters)
Dim webRequest As HttpWebRequest = HttpWebRequest.Create(uri)
webRequest.Method = "POST"
webRequest.ContentType = "application/x-www-form-urlencoded"
webRequest.KeepAlive = False
webRequest.AllowAutoRedirect = False
webRequest.ContentLength = uriParameters.Length
Dim writer As System.IO.StreamWriter = New System.IO.StreamWriter(webRequest.GetRequestStream())
writer.Write(uriParameters)
writer.Close()
'Read Values back
Dim webResponse As HttpWebResponse = webRequest.GetResponse()
Dim reader As StreamReader = New StreamReader(webResponse.GetResponseStream())
Dim str As String = reader.ReadToEnd()
reader.Close()
Any ideas? The code is pretty simple and looks ok, to me, but maybe I'm wrong??
Thanks for any help!!
Dave.
HTTP