473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Microsoft.XMLHTTP causes all GET values to revert to "0"

[ASP]
'GET THE HTML CONTENT FOR DISPLAY BAND ORIGIN
Dim bandOriginDropdown
On Error Resume Next
set scraper = Server.CreateObject("Microsoft.XMLHTTP")
if err then
bandOriginDropdown = ""
else
scraper.open "GET", path &
"/includes/soa_form_element_plugin.inc.asp", false
scraper.send "tableID=2&fieldID=1&typeID=0"
bandOriginDropdown = scraper.ResponseText
set scraper = nothing
end if
[/ASP]

This is a code snippet based upon a scrape on an included ASP script I
wrote that is designed to produce dynamically generated HTML form
element material based upon query string values that are read into
globally-included arrays:

[ASP]
Dim tableNameArray(2)
tableNameArray(0) = "event"
tableNameArray(1) = "gb"
tableNameArray(2) = "bands"

Dim fieldArray(4,2)
fieldArray(0,0) = "event_name"
fieldArray(0,1) = "event_date"
fieldArray(0,2) = "event_text"
fieldArray(1,0) = "last_name"
fieldArray(1,1) = "url"
fieldArray(1,2) = "fave_bands"
fieldArray(2,0) = "bandStyle"
fieldArray(2,1) = "bandOrigin"
fieldArray(2,2) = "bandDescription"

Dim formElementTypeArray(3)
formElementTypeArray(0) = "dropdown"
formElementTypeArray(1) = "text"
formElementTypeArray(2) = "textarea"
formElementTypeArray(3) = "hidden"
[/ASP]

Here is the ASP script soa_form_element_plugin.inc.asp:

[ASP]
<!--#include virtual=/soa/includes/val_global_vars_functions.asp -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''
' file: soa_form_element_plugin.inc.asp
'
' created by: Phil Powell on 7/24/2005 '
' '
' Produce a dropdown list of band-related items whereby the '
' Request.QueryString collection object determines which field '
' you will obtain and data to produce into an HTML form '
' element type dictated by global variables tableNameArray and '
' fieldArray '
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''

Dim myField, formElementType
if IsNumeric(Request.QueryString("tableID")) then tableName =
tableNameArray(Request.QueryString("tableID"))
if IsNumeric(Request.QueryString("tableID")) and
IsNumeric(Request.QueryString("fieldID")) then
myField = fieldArray(Request.QueryString("tableID"),
Request.QueryString("fieldID"))
end if
if IsNumeric(Request.QueryString("typeID")) then myElementType =
formElementTypeArray(Request.QueryString("typeID") )

Response.Write("tableID = " & Request.QueryString("tableID"))

if not IsNull(myField) and myField <> "" and not IsNull(tableName)
and tableName <> "" then
Dim Conn, rs
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\soa\db\sub.mdb")

sql = "SELECT DISTINCT " & myField & " " &_
"FROM " & tableName & " " &_
"WHERE " & myField & " IS NOT NULL" &_
" AND " & myField & " <> '' " &_
"ORDER BY " & myField & " ASC"

set rs = Conn.execute(sql)
if strcomp(lcase(myElementType), "text") = 0 then
%>
<input name="my_<%= myField %>" size="50" maxlength="255" value="<%=
Replace(Request.Form("my_" & myField), """", "&quot;") %>">
<%
elseif strcomp(lcase(myElementType), "textarea") = 0 then
%>
<textarea name="my_<%= myField %>" rows="8" cols="40"><%=
Replace(Request.Form("my_" & myField), "<", "&lt;") %></textarea>
<%
elseif strcomp(lcase(myElementType), "hidden") = 0 then
%>
<input type="hidden" name="my_<%= myField %>" value="<%=
Replace(Request.Form("my_" & myField), """", "&quot;") %>">
<%
elseif strcomp(lcase(myElementType), "dropdown") = 0 then
%>

<select name="my_<%= myField %>">
<option value="">Choose From Below:</option>
<option value="">------------------</option>

<%
do until rs.eof
%>

<option value="<%= rs("" & myField & "") %>"<%

if strcomp(Request.Form("my_" & myField), rs("" & myField & "")) =
0 then Response.Write(" selected")

%>><%= rs("" & myField & "") %></option>

<%
rs.moveNext
loop
set rs = nothing
%>

</select>

<%
end if ' END OF FORM ELEMENT TYPE SELECTION

end if ' END OF DISPLAY

Conn.Close
set Conn = nothing
%>
[/ASP]

Sorry so much code, but there is no way I can think of to explain my
problem.

Here is the output of the Response.Write:

tableID =
However, if I call the URL directly

http://www3.brinkster.com/soa/includ...dID=1&typeID=0

This is what I get:

tableID = 2
Could someone help me with this one? It's live and broken and I can't
fix it (up until 4:30am on this and have had no luck fixing it)

Thanx
Phil

Jul 25 '05 #1
3 1980


Phil Powell wrote:
[ASP]
'GET THE HTML CONTENT FOR DISPLAY BAND ORIGIN
Dim bandOriginDropdown
On Error Resume Next
set scraper = Server.CreateObject("Microsoft.XMLHTTP")
if err then
bandOriginDropdown = ""
else
scraper.open "GET", path &
"/includes/soa_form_element_plugin.inc.asp", false
scraper.send "tableID=2&fieldID=1&typeID=0"


A HTTP GET request does not have a request body so it makes no sense to
pass anything to the send method if you do open "GET".
If you want to pass values with a GET request then the only way is to
use the query string part of the URL e.g.
scraper.open "GET", path &
"/includes/soa_form_element_plugin.inc.asp" &
"?tableID=2&fieldID=1&typeID=0"
Then soa_form_element_plugin.inc.asp can read out
Request.QueryString("tableID")
for instance.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 25 '05 #2
Thanx that's what I wound up trying last night for it to work. Please
explain why HTTP GET request does not have a request body yet HTTP POST
apparently does. They are both HTTP-based collection objects, so they
should both have a request body, just in different formats, one via the
URL and the other via an HTTP POST method.

Phil

Jul 25 '05 #3


Phil Powell wrote:
Please
explain why HTTP GET request does not have a request body yet HTTP POST
apparently does. They are both HTTP-based collection objects, so they
should both have a request body, just in different formats, one via the
URL and the other via an HTTP POST method.


Look into the HTTP specification, a HTTP GET request does not have a
request body, it consists solely of the request line and the request
headers.
POST or PUT requests have a request body.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 25 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
3124
by: MuZZy | last post by:
Hi, Lately i've been (and still am) fixing some memory leaks problems in the project i just took over when i got this new job. Among the other issues i've noticed that for localy created objects...
1
6555
by: Raúl Martín | last post by:
I´ve a function in asp that run correctly but If I tried to change it forasp.net in asp: xmlHTTP = CreateObject("Microsoft.XMLHTTP") And I thought to use this sentence for asp.net but the...
0
1710
by: yma | last post by:
Hi, I have a web.config file that contains <httpHandlers> section that causes "cannot load file..." error. If I delete this section, it is OK. Why did vb.net add this section? It does not add...
3
37797
by: Ed | last post by:
Hi, I want to load data to a table in Sql Server from a dataset table in my vb.net app using a dataAdapter. I know how to do this as follows (my question is to see if I can reduce the amount...
3
7657
by: ronlym | last post by:
hi, I have some client with IE 6 sp1 that when I run the following line I have an exception : var poster = new activexobject("Microsoft.xmlHttp"|); The web page that call this js line is ssl. Do...
5
2148
by: veaux | last post by:
I'm thinking this is easy but can't get it. I have a table with following: Table1 Date 1/1/2007 Table2 Type 0107 (This is MMYY of above) So I'm having trouble using a query to turn the...
15
2647
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it...
1
6032
by: H | last post by:
Just trying to create a basic xmlhttpobject. However, the following always returns null xmlhttpobj = New ActiveXObject("Microsoft.XMLHTTP") (it is Microsoft. and not Msxml2. I've already...
13
3475
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to...
5
6463
by: anEchteTrilingue | last post by:
Hi everybody. Thank you for reading my post. I am having trouble getting "this" to work in all versions of IE (it's fine in Firefox, opera, konqueror, etc). What I would like to do is add an...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.