Hi,

How do I simulate this from the server side:

<form name="SearchForm" method="POST" id="SearchForm"
action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">

I have generally been posting data using:

Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "POST","http://SOMEURL/Search.asp?" & strParmList, False
xml.Send

The above is fine for passing URL parameters, but I need to simulate it
coming from a form which has a name. How do I pass the form name which
is used at the posted URL?

Help!

Re: Simulate form post from Server Side by Tim

Tim
Wed Sep 26 05:39:09 PDT 2007

"BarryX" <barry@praxcom.NOfreeserve.co.SPAMuk> wrote:

>Hi,
>
>How do I simulate this from the server side:
>
><form name="SearchForm" method="POST" id="SearchForm"
>action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">
>
>I have generally been posting data using:
>
> Set xml = Server.CreateObject("Microsoft.XMLHTTP")
> xml.Open "POST","http://SOMEURL/Search.asp?" & strParmList, False
> xml.Send
>
>The above is fine for passing URL parameters, but I need to simulate it
>coming from a form which has a name. How do I pass the form name which
>is used at the posted URL?

AFAIK, the "name" attribute of a form tag really has no meaning and is
never transmitted to the server. On a normal HTML page, if you want to
send an extra bit of data you use a <input type="hidden" > element.

--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
http://members.cox.net/slatteryt

Re: Simulate form post from Server Side by Bob

Bob
Wed Sep 26 05:41:41 PDT 2007

BarryX wrote:
> Hi,
>
> How do I simulate this from the server side:
>
> <form name="SearchForm" method="POST" id="SearchForm"
> action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">
>
> I have generally been posting data using:
>
> Set xml = Server.CreateObject("Microsoft.XMLHTTP")
> xml.Open "POST","http://SOMEURL/Search.asp?" & strParmList, False
> xml.Send
>
> The above is fine for passing URL parameters, but I need to simulate
> it coming from a form which has a name. How do I pass the form name
> which is used at the posted URL?
>

1. In server-side code, use Microsoft.ServerXMLHTTP
2. I don;'t think this is possible due to security restrictions. What
are you trying to accomplish?


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: Simulate form post from Server Side by Evertjan

Evertjan
Wed Sep 26 08:22:25 PDT 2007

Bob Barrows [MVP] wrote on 26 sep 2007 in
microsoft.public.inetserver.asp.general:

> BarryX wrote:
>> Hi,
>>
>> How do I simulate this from the server side:
>>
>> <form name="SearchForm" method="POST" id="SearchForm"
>> action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">
>>


> 1. In server-side code, use Microsoft.ServerXMLHTTP
> 2. I don;'t think this is possible due to security restrictions. What
> are you trying to accomplish?
>
>

<%
url = "http://www.espn.com/main.html"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
xmlhttp.send "x=1&y=2"
Response.write xmlhttp.responseText
set xmlhttp = nothing
%>

<http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-
remote-web-page.html>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Simulate form post from Server Side by Bob

Bob
Wed Sep 26 08:39:45 PDT 2007

Evertjan. wrote:
> Bob Barrows [MVP] wrote on 26 sep 2007 in
> microsoft.public.inetserver.asp.general:
>
>> BarryX wrote:
>>> Hi,
>>>
>>> How do I simulate this from the server side:
>>>
>>> <form name="SearchForm" method="POST" id="SearchForm"
>>> action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">
>>>
>
>
>> 1. In server-side code, use Microsoft.ServerXMLHTTP
>> 2. I don;'t think this is possible due to security restrictions. What
>> are you trying to accomplish?
>>
>>
>
> <%
> url = "http://www.espn.com/main.html"
> set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
> xmlhttp.open "POST", url, false
> xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
> urlencoded"
> xmlhttp.send "x=1&y=2"
> Response.write xmlhttp.responseText
> set xmlhttp = nothing
> %>
>
> <http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-
> remote-web-page.html>
>
I'm not sure what your point is ... how does this help the OP accomplish
his task?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



Re: Simulate form post from Server Side by Evertjan

Evertjan
Wed Sep 26 09:42:25 PDT 2007

Bob Barrows [MVP] wrote on 26 sep 2007 in
microsoft.public.inetserver.asp.general:

> Evertjan. wrote:
>> Bob Barrows [MVP] wrote on 26 sep 2007 in
>> microsoft.public.inetserver.asp.general:
>>
>>> BarryX wrote:
>>>> Hi,
>>>>
>>>> How do I simulate this from the server side:
>>>>
>>>> <form name="SearchForm" method="POST" id="SearchForm"
>>>> action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">
>>>>
>>
>>
>>> 1. In server-side code, use Microsoft.ServerXMLHTTP
>>> 2. I don;'t think this is possible due to security restrictions.
>>> What are you trying to accomplish?
>>>
>>>
>>
>> <%
>> url = "http://www.espn.com/main.html"
>> set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
>> xmlhttp.open "POST", url, false
>> xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
>> urlencoded"
>> xmlhttp.send "x=1&y=2"
>> Response.write xmlhttp.responseText
>> set xmlhttp = nothing
>> %>
>>
>> <http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-
>> remote-web-page.html>
>>
> I'm not sure what your point is ... how does this help the OP
> accomplish his task?
>

Oops, I should have quoted Shakespeare, not aspfaq.

["A form by any other name ..."]


<%
url = "http://www.espn.com/main.html"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
urlencoded"
xmlhttp.send "theFormName=myNewForm"
Response.write xmlhttp.responseText
set xmlhttp = nothing
%>

[Doing what html can only do in a (possibly hidden) input]


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: Simulate form post from Server Side by BarryX

BarryX
Sat Sep 29 04:11:02 PDT 2007


This looks promising Evertjan.

Will mess with it. Thanks.


"Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
news:Xns99B7BE4C6C278eejj99@194.109.133.242...
> Bob Barrows [MVP] wrote on 26 sep 2007 in
> microsoft.public.inetserver.asp.general:
>
> > Evertjan. wrote:
> >> Bob Barrows [MVP] wrote on 26 sep 2007 in
> >> microsoft.public.inetserver.asp.general:
> >>
> >>> BarryX wrote:
> >>>> Hi,
> >>>>
> >>>> How do I simulate this from the server side:
> >>>>
> >>>> <form name="SearchForm" method="POST" id="SearchForm"
> >>>> action="http://SOMEURL/Search.ASP?Parm1=1&Parm2=2">
> >>>>
> >>
> >>
> >>> 1. In server-side code, use Microsoft.ServerXMLHTTP
> >>> 2. I don;'t think this is possible due to security restrictions.
> >>> What are you trying to accomplish?
> >>>
> >>>
> >>
> >> <%
> >> url = "http://www.espn.com/main.html"
> >> set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
> >> xmlhttp.open "POST", url, false
> >> xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
> >> urlencoded"
> >> xmlhttp.send "x=1&y=2"
> >> Response.write xmlhttp.responseText
> >> set xmlhttp = nothing
> >> %>
> >>
> >> <http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-
> >> remote-web-page.html>
> >>
> > I'm not sure what your point is ... how does this help the OP
> > accomplish his task?
> >
>
> Oops, I should have quoted Shakespeare, not aspfaq.
>
> ["A form by any other name ..."]
>
>
> <%
> url = "http://www.espn.com/main.html"
> set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
> xmlhttp.open "POST", url, false
> xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-
> urlencoded"
> xmlhttp.send "theFormName=myNewForm"
> Response.write xmlhttp.responseText
> set xmlhttp = nothing
> %>
>
> [Doing what html can only do in a (possibly hidden) input]
>
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)



Re: Simulate form post from Server Side by BarryX

BarryX
Sat Sep 29 06:52:06 PDT 2007

This is a multi-part message in MIME format.

------=_NextPart_000_00C8_01C802A8.4DF0FF20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


It might help if I describe the full problem. I am trying to simulate =
this:
=20
<form name=3D"SearchForm" method=3D"POST" id=3D"SearchForm" =
action=3D"Search.ASP?WCI=3DgetPage">
<input type=3D"hidden" name=3D"PAGE">
<input type=3D"hidden" name=3D"IsPortfolio">
<input type=3D"hidden" name=3D"DEL">
<input type=3D"hidden" name=3D"PropertyID">
<input type=3D"hidden" name=3D"GTYP" value=3D"0">
<input type=3D"hidden" name=3D"PER" value=3D"5">
<input type=3D"hidden" name=3D"RestrictSearch" value=3D"">
<input type=3D"hidden" Name=3D"StyleSheet" value=3D"">
<input type=3D"hidden" name=3D"STYPE" value=3D"0">
<input type=3D"hidden" name=3D"Exit" value=3D"">
<input type=3D"hidden" name=3D"GID" value=3D"422">
<input type=3D"hidden" name=3D"CURRENCY" value=3D"GBP">

So URL parameters AND form parameters going to the POSTed server. This =
is currently triggered from the client side with a click to this:
=20
javascript:document.SearchForm.PAGE.value=3D'2';document.SearchForm.submi=
t();

Doing the above works OK so all I want to do is simulate this. The =
object being to bring back page 2 of N pages. A parameter is being =
passed to the server by doing this. So I really need to simulate: =
SearchForm.PAGE.value=3D'2'. The server belongs to someone else so I =
can't change anything at the POSTed end.
=20
My Server Side code to simulate is as follows:

Set xml =3D Server.CreateObject("MSXML2.ServerXMLHTTP")
strURL =3D "?WCI=3DgetPage" & _
"&IsPortfolio" & _
"&DEL" & _
"&PropertyID" & _
"&GTYP=3D0" & _ =20
"&PAGE=3D2" & _
"&PER=3D5" & _
"&SearchForm.asp" & _
"&StyleSheet" & _
"&STYPE=3D0" & _
"&Exit" & _
"&GID=3D422" & _
"&CURRENCY=3DGBP"
xml.Open "POST","search.asp" & strURL, False

' ???????????????? Maybe this is the area=20
xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xml.Send "SearchForm"
=20
' Create XML DOM object for the XML
Set xmlDoc =3D Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async =3D False
xmlDoc.loadXML xml.responseText
=20
' Create DOM object for the XSL
Set xslDoc =3D Server.CreateObject("Microsoft.XMLDOM")
xslDoc.async =3D False
=20
' Load a stylesheet
xslDoc.load (Server.MapPath("Summary.XSLT")) =20
=20
' Convert XML using XSL to HTML
strHTML =3D xmlDoc.transformNode(xslDoc)
=20
' Send to client
Response.Write strHTML
=20
' All finished
Set xml =3D Nothing
Set xslDoc =3D Nothing=20
Set xmlDoc =3D Nothing

Any help appreciated.
Barry.


"BarryX" <barry@praxcom.NOfreeserve.co.SPAMuk> wrote in message =
news:uWLMjjoAIHA.5184@TK2MSFTNGP02.phx.gbl...
>=20
> This looks promising Evertjan.
>=20
> Will mess with it. Thanks.
>=20
>=20
> "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
> news:Xns99B7BE4C6C278eejj99@194.109.133.242...
> > Bob Barrows [MVP] wrote on 26 sep 2007 in
> > microsoft.public.inetserver.asp.general:
> >
> > > Evertjan. wrote:
> > >> Bob Barrows [MVP] wrote on 26 sep 2007 in
> > >> microsoft.public.inetserver.asp.general:
> > >>
> > >>> BarryX wrote:
> > >>>> Hi,
> > >>>>
> > >>>> How do I simulate this from the server side:
> > >>>>
> > >>>> <form name=3D"SearchForm" method=3D"POST" id=3D"SearchForm"
> > >>>> action=3D"http://SOMEURL/Search.ASP?Parm1=3D1&Parm2=3D2">
> > >>>>
> > >>
> > >>
> > >>> 1. In server-side code, use Microsoft.ServerXMLHTTP
> > >>> 2. I don;'t think this is possible due to security restrictions.
> > >>> What are you trying to accomplish?
> > >>>
> > >>>
> > >>
> > >> <%
> > >> url =3D "http://www.espn.com/main.html"
> > >> set xmlhttp =3D CreateObject("MSXML2.ServerXMLHTTP")
> > >> xmlhttp.open "POST", url, false
> > >> xmlhttp.setRequestHeader "Content-Type", =
"application/x-www-form-
> > >> urlencoded"
> > >> xmlhttp.send "x=3D1&y=3D2"
> > >> Response.write xmlhttp.responseText
> > >> set xmlhttp =3D nothing
> > >> %>
> > >>
> > >> =
<http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-
> > >> remote-web-page.html>
> > >>
> > > I'm not sure what your point is ... how does this help the OP
> > > accomplish his task?
> > >
> >
> > Oops, I should have quoted Shakespeare, not aspfaq.
> >
> > ["A form by any other name ..."]
> >
> >
> > <%
> > url =3D "http://www.espn.com/main.html"
> > set xmlhttp =3D CreateObject("MSXML2.ServerXMLHTTP")
> > xmlhttp.open "POST", url, false
> > xmlhttp.setRequestHeader "Content-Type", =
"application/x-www-form-
> > urlencoded"
> > xmlhttp.send "theFormName=3DmyNewForm"
> > Response.write xmlhttp.responseText
> > set xmlhttp =3D nothing
> > %>
> >
> > [Doing what html can only do in a (possibly hidden) input]
> >
> >
> > --=20
> > Evertjan.
> > The Netherlands.
> > (Please change the x'es to dots in my emailaddress)
>=20
>
------=_NextPart_000_00C8_01C802A8.4DF0FF20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1589" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>&nbsp;</DIV>
<DIV>
<DIV><SPAN class=3D500132513-29092007><FONT color=3D#0000ff =
size=3D2><FONT=20
color=3D#000000>It might help if I describe the full problem. I am =
trying to=20
simulate this:<BR></FONT>&nbsp;<BR>&lt;form name=3D"SearchForm" =
method=3D"POST"=20
id=3D"SearchForm" action=3D"Search.ASP?WCI=3DgetPage"&gt;<BR>&lt;input =
type=3D"hidden"=20
name=3D"PAGE"&gt;<BR>&lt;input type=3D"hidden" =
name=3D"IsPortfolio"&gt;<BR>&lt;input=20
type=3D"hidden" name=3D"DEL"&gt;<BR>&lt;input type=3D"hidden"=20
name=3D"PropertyID"&gt;<BR>&lt;input type=3D"hidden" name=3D"GTYP"=20
value=3D"0"&gt;<BR>&lt;input type=3D"hidden" name=3D"PER" =
value=3D"5"&gt;<BR>&lt;input=20
type=3D"hidden" name=3D"RestrictSearch" value=3D""&gt;<BR>&lt;input =
type=3D"hidden"=20
Name=3D"StyleSheet" value=3D""&gt;<BR>&lt;input type=3D"hidden" =
name=3D"STYPE"=20
value=3D"0"&gt;<BR>&lt;input type=3D"hidden" name=3D"Exit" =
value=3D""&gt;<BR>&lt;input=20
type=3D"hidden" name=3D"GID" value=3D"422"&gt;<BR>&lt;input =
type=3D"hidden"=20
name=3D"CURRENCY" value=3D"GBP"&gt;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D500132513-29092007><FONT color=3D#0000ff =
size=3D2><SPAN=20
class=3D500132513-29092007><FONT color=3D#0000ff size=3D2><FONT =
color=3D#000000>So URL=20
parameters AND form parameters going to the POSTed =
server</FONT></FONT></SPAN>.=20
</FONT></SPAN><SPAN class=3D500132513-29092007><FONT color=3D#0000ff =
size=3D2><FONT=20
color=3D#000000>This is currently triggered from the client side with a =
click to=20
this:<BR></FONT>&nbsp;<BR>javascript:document.SearchForm.PAGE.value=3D'2'=
;document.SearchForm.submit();</FONT></SPAN></DIV>
<DIV><SPAN class=3D500132513-29092007><FONT color=3D#0000ff=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D500132513-29092007><FONT color=3D#0000ff =
size=3D2><FONT=20
color=3D#000000>Doing the above&nbsp;works OK so all I want to do is =
simulate=20
this. </FONT><FONT color=3D#000000>The object being to bring back page 2 =
of N=20
pages.&nbsp;A parameter is being passed&nbsp;to the server by doing =
this. So I=20
really need to simulate: SearchForm.PAGE.value=3D'2'.&nbsp;The server =
belongs to=20
someone else so I can't change anything at the POSTed=20
end.<BR></FONT>&nbsp;<BR></FONT></SPAN><SPAN =
class=3D500132513-29092007><FONT=20
size=3D2>My&nbsp;Server Side code to simulate is as=20
follows:</FONT></SPAN></DIV><SPAN class=3D500132513-29092007><FONT =
color=3D#0000ff=20
size=3D2>
<DIV><FONT face=3DArial color=3D#000000></FONT><FONT face=3DArial=20
color=3D#000000></FONT><BR>Set xml =3D=20
Server.CreateObject("MSXML2.ServerXMLHTTP")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;strURL=20
=3D "?WCI=3DgetPage"&nbsp;&nbsp;&amp; _<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;IsPortfolio"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&amp;=20
_<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;DEL"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&amp; _<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;PropertyID"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;=20
_<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;GTYP=3D0"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;=20
&amp; _&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;PAGE=3D2"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
&amp; _<BR></FONT></SPAN><SPAN class=3D500132513-29092007><FONT =
color=3D#0000ff=20
size=3D2>&nbsp;&nbsp;&nbsp;=20
"&amp;PER=3D5"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;=20
&amp; _<BR>&nbsp;&nbsp;&nbsp; =
"&amp;SearchForm.asp"&nbsp;&nbsp;&nbsp;&nbsp;=20
&amp; _<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;StyleSheet"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;=20
_<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;STYPE=3D0"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&amp;=20
_<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;Exit"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&amp; _<BR>&nbsp;&nbsp;&nbsp;=20
"&amp;GID=3D422"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; &amp;=20
_<BR>&nbsp;&nbsp;&nbsp; "&amp;CURRENCY=3DGBP"<BR>&nbsp; &nbsp;&nbsp; =
xml.Open=20
"POST","search.asp" &amp; strURL, False<BR></FONT></SPAN></DIV>
<DIV><SPAN class=3D500132513-29092007><FONT color=3D#0000ff =
size=3D2><FONT=20
color=3D#ff0000>'&nbsp;???????????????? Maybe this is the=20
area&nbsp;<BR>xml.setRequestHeader "Content-Type",=20
"application/x-www-form-urlencoded"<BR>xml.Send=20
"SearchForm"<BR></FONT>&nbsp;</FONT></SPAN></DIV>
<DIV><SPAN class=3D500132513-29092007><FONT color=3D#0000ff size=3D2>' =
Create XML DOM=20
object for the XML<BR>Set xmlDoc =3D=20
Server.CreateObject("Microsoft.XMLDOM")<BR>xmlDoc.async =3D=20
False<BR>xmlDoc.loadXML xml.responseText<BR>&nbsp;<BR>' Create DOM =
object for=20
the XSL<BR>Set xslDoc =3D =
Server.CreateObject("Microsoft.XMLDOM")<BR>xslDoc.async=20
=3D False<BR>&nbsp;<BR>' Load a stylesheet<BR>xslDoc.load=20
(Server.MapPath("Summary.XSLT"))&nbsp; <BR>&nbsp;<BR>' Convert XML using =
XSL to=20
HTML<BR>strHTML =3D xmlDoc.transformNode(xslDoc)<BR>&nbsp;<BR>' Send to=20
client<BR>Response.Write strHTML<BR>&nbsp;<BR>' All finished<BR>Set xml =
=3D=20
Nothing<BR>Set xslDoc =3D Nothing&nbsp;<BR>Set xmlDoc =3D=20
Nothing</FONT></SPAN></DIV>
<DIV><FONT color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D500132513-29092007><FONT size=3D2>Any help=20
appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=3D500132513-29092007><FONT=20
size=3D2>Barry.</FONT></SPAN></DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>"BarryX" &lt;<A=20
href=3D"mailto:barry@praxcom.NOfreeserve.co.SPAMuk">barry@praxcom.NOfrees=
erve.co.SPAMuk</A>&gt;=20
wrote in message <A=20
href=3D"news:uWLMjjoAIHA.5184@TK2MSFTNGP02.phx.gbl">news:uWLMjjoAIHA.5184=
@TK2MSFTNGP02.phx.gbl</A>...</DIV>&gt;=20
<BR>&gt; This looks promising Evertjan.<BR>&gt; <BR>&gt; Will mess with =
it.=20
Thanks.<BR>&gt; <BR>&gt; <BR>&gt; "Evertjan." &lt;<A=20
href=3D"mailto:exjxw.hannivoort@interxnl.net">exjxw.hannivoort@interxnl.n=
et</A>&gt;=20
wrote in message<BR>&gt; <A=20
href=3D"news:Xns99B7BE4C6C278eejj99@194.109.133.242">news:Xns99B7BE4C6C27=
8eejj99@194.109.133.242</A>...<BR>&gt;=20
&gt; Bob Barrows [MVP] wrote on 26 sep 2007 in<BR>&gt; &gt;=20
microsoft.public.inetserver.asp.general:<BR>&gt; &gt;<BR>&gt; &gt; &gt;=20
Evertjan. wrote:<BR>&gt; &gt; &gt;&gt; Bob Barrows [MVP] wrote on 26 sep =
2007=20
in<BR>&gt; &gt; &gt;&gt; =
microsoft.public.inetserver.asp.general:<BR>&gt; &gt;=20
&gt;&gt;<BR>&gt; &gt; &gt;&gt;&gt; BarryX wrote:<BR>&gt; &gt; =
&gt;&gt;&gt;&gt;=20
Hi,<BR>&gt; &gt; &gt;&gt;&gt;&gt;<BR>&gt; &gt; &gt;&gt;&gt;&gt; How do I =

simulate this from the server side:<BR>&gt; &gt; =
&gt;&gt;&gt;&gt;<BR>&gt; &gt;=20
&gt;&gt;&gt;&gt; &lt;form name=3D"SearchForm" method=3D"POST"=20
id=3D"SearchForm"<BR>&gt; &gt; &gt;&gt;&gt;&gt; action=3D"<A=20
href=3D"http://SOMEURL/Search.ASP?Parm1=3D1&amp;Parm2=3D2">http://SOMEURL=
/Search.ASP?Parm1=3D1&amp;Parm2=3D2</A>"&gt;<BR>&gt;=20
&gt; &gt;&gt;&gt;&gt;<BR>&gt; &gt; &gt;&gt;<BR>&gt; &gt; =
&gt;&gt;<BR>&gt; &gt;=20
&gt;&gt;&gt; 1. In server-side code, use Microsoft.ServerXMLHTTP<BR>&gt; =
&gt;=20
&gt;&gt;&gt; 2. I don;'t think this is possible due to security=20
restrictions.<BR>&gt; &gt; &gt;&gt;&gt; What are you trying to=20
accomplish?<BR>&gt; &gt; &gt;&gt;&gt;<BR>&gt; &gt; &gt;&gt;&gt;<BR>&gt; =
&gt;=20
&gt;&gt;<BR>&gt; &gt; &gt;&gt; &lt;%<BR>&gt; &gt;=20
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; url =3D "<A=20
href=3D"http://www.espn.com/main.html">http://www.espn.com/main.html</A>"=
<BR>&gt;=20
&gt; &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; set xmlhttp =3D=20
CreateObject("MSXML2.ServerXMLHTTP")<BR>&gt; &gt;=20
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.open "POST", url, false<BR>&gt; =
&gt;=20
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.setRequestHeader =
"Content-Type",=20
"application/x-www-form-<BR>&gt; &gt; &gt;&gt; urlencoded"<BR>&gt; &gt;=20
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.send "x=3D1&amp;y=3D2"<BR>&gt; =
&gt;=20
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; Response.write =
xmlhttp.responseText<BR>&gt;=20
&gt; &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; set xmlhttp =3D nothing<BR>&gt; =
&gt;=20
&gt;&gt; %&gt;<BR>&gt; &gt; &gt;&gt;<BR>&gt; &gt; &gt;&gt; &lt;<A=20
href=3D"http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-o=
f-a">http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a=
</A>-<BR>&gt;=20
&gt; &gt;&gt; remote-web-page.html&gt;<BR>&gt; &gt; &gt;&gt;<BR>&gt; =
&gt; &gt;=20
I'm not sure what your point is ... how does this help the OP<BR>&gt; =
&gt; &gt;=20
accomplish his task?<BR>&gt; &gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; Oops, I =
should=20
have quoted Shakespeare, not aspfaq.<BR>&gt; &gt;<BR>&gt; &gt; ["A form =
by any=20
other name ..."]<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; &lt;%<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; url =3D "<A=20
href=3D"http://www.espn.com/main.html">http://www.espn.com/main.html</A>"=
<BR>&gt;=20
&gt;&nbsp;&nbsp;&nbsp;&nbsp; set xmlhttp =3D=20
CreateObject("MSXML2.ServerXMLHTTP")<BR>&gt; =
&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
xmlhttp.open "POST", url, false<BR>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
xmlhttp.setRequestHeader "Content-Type", =
"application/x-www-form-<BR>&gt; &gt;=20
urlencoded"<BR>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.send=20
"theFormName=3DmyNewForm"<BR>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; =
Response.write=20
xmlhttp.responseText<BR>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; set xmlhttp =
=3D=20
nothing<BR>&gt; &gt; %&gt;<BR>&gt; &gt;<BR>&gt; &gt; [Doing what html =
can only=20
do in a (possibly hidden) input]<BR>&gt; &gt;<BR>&gt; &gt;<BR>&gt; &gt; =
--=20
<BR>&gt; &gt; Evertjan.<BR>&gt; &gt; The Netherlands.<BR>&gt; &gt; =
(Please=20
change the x'es to dots in my emailaddress)<BR>&gt; <BR>&gt; =
</BODY></HTML>

------=_NextPart_000_00C8_01C802A8.4DF0FF20--


Re: Simulate form post from Server Side by Anthony

Anthony
Sun Sep 30 11:53:31 PDT 2007


BarryX" <barry@praxcom.NOfreeserve.co.SPAMuk> wrote in message
news:%23G2Rj9pAIHA.288@TK2MSFTNGP02.phx.gbl...
>>>>>>>>>>>>>>
It might help if I describe the full problem. I am trying to simulate this:

<form name="SearchForm" method="POST" id="SearchForm"
action="Search.ASP?WCI=getPage">
<input type="hidden" name="PAGE">
<input type="hidden" name="IsPortfolio">
<input type="hidden" name="DEL">
<input type="hidden" name="PropertyID">
<input type="hidden" name="GTYP" value="0">
<input type="hidden" name="PER" value="5">
<input type="hidden" name="RestrictSearch" value="">
<input type="hidden" Name="StyleSheet" value="">
<input type="hidden" name="STYPE" value="0">
<input type="hidden" name="Exit" value="">
<input type="hidden" name="GID" value="422">
<input type="hidden" name="CURRENCY" value="GBP">

So URL parameters AND form parameters going to the POSTed server. This is
currently triggered from the client side with a click to this:

javascript:document.SearchForm.PAGE.value='2';document.SearchForm.submit();

Doing the above works OK so all I want to do is simulate this. The object
being to bring back page 2 of N pages. A parameter is being passed to the
server by doing this. So I really need to simulate:
SearchForm.PAGE.value='2'. The server belongs to someone else so I can't
change anything at the POSTed end.

My Server Side code to simulate is as follows:

Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
strURL = "?WCI=getPage" & _
"&IsPortfolio" & _
"&DEL" & _
"&PropertyID" & _
"&GTYP=0" & _
"&PAGE=2" & _
"&PER=5" & _
"&SearchForm.asp" & _
"&StyleSheet" & _
"&STYPE=0" & _
"&Exit" & _
"&GID=422" & _
"&CURRENCY=GBP"
xml.Open "POST","search.asp" & strURL, False

' ???????????????? Maybe this is the area
xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xml.Send "SearchForm"

' Create XML DOM object for the XML
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = False
xmlDoc.loadXML xml.responseText

' Create DOM object for the XSL
Set xslDoc = Server.CreateObject("Microsoft.XMLDOM")
xslDoc.async = False

' Load a stylesheet
xslDoc.load (Server.MapPath("Summary.XSLT"))

' Convert XML using XSL to HTML
strHTML = xmlDoc.transformNode(xslDoc)

' Send to client
Response.Write strHTML

' All finished
Set xml = Nothing
Set xslDoc = Nothing
Set xmlDoc = Nothing

Any help appreciated.
Barry.
<<<<<<<<<<<

If you are doing simulations then one tool that is indispensible is
www.fiddlertool.com

With this running use a browser to perform a Form post you want to emulate.
You can now check the recorded session in the tool an you'll see what you
need to reproduce.

If you noticed from the example Evertjan gave you when the form method is a
POST the set of field values should be sent as the entity body of the
request, IOW a string encoded as URL search section is passed as the
paremeter of the send function.

Hence your code should look more like:-

Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")

strURL = "http//host.domain.com/search.asp?WCI=getPage"

strDat = "IsPortfolio=" & _
"&DEL=" & _
"&PropertyID=" & _
"&GTYP=0" & _
"&PAGE=2" & _
"&PER=5" & _
"&RestrictSearch=" & _
"&StyleSheet=" & _
"&STYPE=0" & _
"&Exit=" & _
"&GID=422" & _
"&CURRENCY=GBP"

xml.Open "POST",strURL, False
xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xml.Send strDat

Note that any values that you might concatenate into the data needs to be
urlencoded,

BTW, are you sure the form post actually results in an XML response?


--
Anthony Jones - MVP ASP/ASP.NET



Re: Simulate form post from Server Side by BarryX

BarryX
Mon Oct 01 02:58:02 PDT 2007


Hi Anthony,

Yes, definitely XML coming back.

The example:

javascript:document.SearchForm.PAGE.value='2';document.SearchForm.submit()

was provided as a template example to me from the server owner. I could
simply do this and it would work fine. But then I would have to transform
the XML at the client side and I want it all on the server side.

Doing the above, ie. setting PAGE=2 from the client side does not seem to be
working when issued from the server side. Trouble is, it is very difficult
to work out why it doesn't work. I just get an empty page back.

Barry.



"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:O2AhzM5AIHA.4568@TK2MSFTNGP02.phx.gbl...
>
> BarryX" <barry@praxcom.NOfreeserve.co.SPAMuk> wrote in message
> news:%23G2Rj9pAIHA.288@TK2MSFTNGP02.phx.gbl...
> >>>>>>>>>>>>>>
> It might help if I describe the full problem. I am trying to simulate
this:
>
> <form name="SearchForm" method="POST" id="SearchForm"
> action="Search.ASP?WCI=getPage">
> <input type="hidden" name="PAGE">
> <input type="hidden" name="IsPortfolio">
> <input type="hidden" name="DEL">
> <input type="hidden" name="PropertyID">
> <input type="hidden" name="GTYP" value="0">
> <input type="hidden" name="PER" value="5">
> <input type="hidden" name="RestrictSearch" value="">
> <input type="hidden" Name="StyleSheet" value="">
> <input type="hidden" name="STYPE" value="0">
> <input type="hidden" name="Exit" value="">
> <input type="hidden" name="GID" value="422">
> <input type="hidden" name="CURRENCY" value="GBP">
>
> So URL parameters AND form parameters going to the POSTed server. This is
> currently triggered from the client side with a click to this:
>
>
javascript:document.SearchForm.PAGE.value='2';document.SearchForm.submit();
>
> Doing the above works OK so all I want to do is simulate this. The object
> being to bring back page 2 of N pages. A parameter is being passed to the
> server by doing this. So I really need to simulate:
> SearchForm.PAGE.value='2'. The server belongs to someone else so I can't
> change anything at the POSTed end.
>
> My Server Side code to simulate is as follows:
>
> Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
> strURL = "?WCI=getPage" & _
> "&IsPortfolio" & _
> "&DEL" & _
> "&PropertyID" & _
> "&GTYP=0" & _
> "&PAGE=2" & _
> "&PER=5" & _
> "&SearchForm.asp" & _
> "&StyleSheet" & _
> "&STYPE=0" & _
> "&Exit" & _
> "&GID=422" & _
> "&CURRENCY=GBP"
> xml.Open "POST","search.asp" & strURL, False
>
> ' ???????????????? Maybe this is the area
> xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
> xml.Send "SearchForm"
>
> ' Create XML DOM object for the XML
> Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
> xmlDoc.async = False
> xmlDoc.loadXML xml.responseText
>
> ' Create DOM object for the XSL
> Set xslDoc = Server.CreateObject("Microsoft.XMLDOM")
> xslDoc.async = False
>
> ' Load a stylesheet
> xslDoc.load (Server.MapPath("Summary.XSLT"))
>
> ' Convert XML using XSL to HTML
> strHTML = xmlDoc.transformNode(xslDoc)
>
> ' Send to client
> Response.Write strHTML
>
> ' All finished
> Set xml = Nothing
> Set xslDoc = Nothing
> Set xmlDoc = Nothing
>
> Any help appreciated.
> Barry.
> <<<<<<<<<<<
>
> If you are doing simulations then one tool that is indispensible is
> www.fiddlertool.com
>
> With this running use a browser to perform a Form post you want to
emulate.
> You can now check the recorded session in the tool an you'll see what you
> need to reproduce.
>
> If you noticed from the example Evertjan gave you when the form method is
a
> POST the set of field values should be sent as the entity body of the
> request, IOW a string encoded as URL search section is passed as the
> paremeter of the send function.
>
> Hence your code should look more like:-
>
> Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
>
> strURL = "http//host.domain.com/search.asp?WCI=getPage"
>
> strDat = "IsPortfolio=" & _
> "&DEL=" & _
> "&PropertyID=" & _
> "&GTYP=0" & _
> "&PAGE=2" & _
> "&PER=5" & _
> "&RestrictSearch=" & _
> "&StyleSheet=" & _
> "&STYPE=0" & _
> "&Exit=" & _
> "&GID=422" & _
> "&CURRENCY=GBP"
>
> xml.Open "POST",strURL, False
> xml.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
> xml.Send strDat
>
> Note that any values that you might concatenate into the data needs to be
> urlencoded,
>
> BTW, are you sure the form post actually results in an XML response?
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>



Re: Simulate form post from Server Side by Anthony

Anthony
Tue Oct 02 00:04:25 PDT 2007

"BarryX" <barry@praxcom.NOfreeserve.co.SPAMuk> wrote in message
news:uZkrDEBBIHA.3780@TK2MSFTNGP05.phx.gbl...
>
> Hi Anthony,
>
> Yes, definitely XML coming back.
>
> The example:
>
> javascript:document.SearchForm.PAGE.value='2';document.SearchForm.submit()
>
> was provided as a template example to me from the server owner. I could
> simply do this and it would work fine. But then I would have to transform
> the XML at the client side and I want it all on the server side.
>
> Doing the above, ie. setting PAGE=2 from the client side does not seem to
be
> working when issued from the server side. Trouble is, it is very difficult
> to work out why it doesn't work. I just get an empty page back.
>

1) Install fiddler.
2) Build a VBScript file to emulate POST (use XmlHttp not ServerXmlHttp).
3) With fiddler use suppliers example of making post.
4) Use VBScript file to make the post.
5) In fiddler compare POSTs made by the two approaches
6) Adjust VBScript until its requests matches the suppliers example
7) Tweak script to use ServerXMLHTTP and check it still works
8) Install code into ASP.




--
Anthony Jones - MVP ASP/ASP.NET