Changing Web pages

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an app that i am developing, it access a website via HttpWebRequest
and HttpWebResponse classes (eg http://thaynann.com/images/) and at the
moment i am able to save all the image files from this page (by grabbing
their URLs and calling WebClient.DownloadData() and save them to my PC), wat
i need to do is to be able to have the applicaiton automatically move to the
next page of images (the issue is that the next page doesnt appear to have
its own URL, it stays at http://thaynann.com/images) and grab the new page of
images and repeat the process to save them.

I have tried lookin at the request and responses that are being used (via
TcpTrace.exe), but i havent had any exp in JavaScript and minimal in HTML
itself, so i get quite lost looking through lines and lines of it

If anyone can help with my problem, that would be much appreciated.

PS, the website isnt real: just used as example

thaynann,
 
Hi,

Most probably the url for the next page is in either a hidden tag, or
embedded in the href of a link , you don't need to use tcptrace, just
analize the page you get,
A tip, using IE get two consecutives pages, save them both ( just the html )
and using diff.exe you may be able to see the parameters being passed.


cheers,
 
Thanx for the reply,

I did wat u suggested and saved 2 consecutve pages through IE, the only
problem i had was, when i saved the html docs (of page 1 and 2), i re-opened
them, and both were of page 1 again, so that leads me to belive that changin
pages would probably be controlled by a JavaScript method somewhere in the
HTML code, i did find a method, (that also appears on the status bar when
then change page button is mouseover (ie...javascript::ChengePage(3,
Document.DocboxListForm) ), this method is the exact same for all pages, the
3 value does not change, nor does the document one), im not sure if posting
this will be any further help, but it cant hurt to try.

Thanx for your help so far Ignacio.

thaynann
 
Hi,

It does depend of how they did it.

without seen the code of the page (and even so) you can only guess, maybe
the keep in session a "current page" number, then in the html you have a
"back" and "next" which depending of which one is used post the correct
page.

what does the ChangePage method does?


cheers,
 
Firstly, sorry it took so long for me to reple to this, been off work for a bit

here is teh code for ChangePage() (i didnt write this, i just pulled it out
of files when i ran TcpTrace, it was written by the company who made my fax
machine)

function ChengePage(kind,win) //kind =3, win = document.DoxboxListForm
{
var i;var workInt;var offset;var totalDoc;var BlockSize;var newOffset;

for (i = 0; i < win.length; i++)
{
if(win.elements.name == "resultRowBlockSize")
BlockSize = win.elements.value;
if(win.elements.name == "totalCount")
totalDoc = win.elements.value;
if(win.elements.name == "offset")
offset = win.elements.value;
}
switch( kind )
{
case 1:
newOffset = 0;break;
case 2:
workInt = (offset - 0) - BlockSize;
if( workInt < 0 ) newOffset = 0;
else newOffset = workInt;break;
case 3:
workInt = (offset - 0) + (BlockSize -0);
if( totalDoc < workInt )
{
for( i=1; ;i++ )
{
workInt = 0;
workInt = (offset - 0) - (BlockSize * i);
if( totalDoc > workInt )
newOffset = workInt;break;
}
}
if( totalDoc == workInt ) newOffset = totalDoc - BlockSize;
else newOffset = workInt;break;
case 4:
for( i=1; ;i++)
{
workInt = 0;
workInt = (offset - 0) + (BlockSize * i);
if( totalDoc == workInt )
newOffset = totalDoc - BlockSize;break;
else if( totalDoc < workInt )
newOffset = workInt - BlockSize;break;
else;
}break;
default:
alert(" ***** parameter err ***** ");break;
}
for (i = 0; i < win.length; i++)
{
if (win.elements.type == "hidden")
if(win.elements.name == "offset")
win.elements.value = newOffset;
}
DocumentBoxFormSubmit( 3, win );
}
 
Hi,

Where is the code for the function DocumentBoxFormSubmit ?

I think that the key here is a <input type=hidden name=offset> , the
function you shown seems to calculate if you need to move to another page,
if so it update the offset indicator and call later this other
DocumentBoxFormSubmit function, what I have no idea what it does :)

put an alert before submit the page and see the value of offset


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



Thaynann said:
Firstly, sorry it took so long for me to reple to this, been off work for
a bit

here is teh code for ChangePage() (i didnt write this, i just pulled it
out
of files when i ran TcpTrace, it was written by the company who made my
fax
machine)

function ChengePage(kind,win) //kind =3, win = document.DoxboxListForm
{
var i;var workInt;var offset;var totalDoc;var BlockSize;var newOffset;

for (i = 0; i < win.length; i++)
{
if(win.elements.name == "resultRowBlockSize")
BlockSize = win.elements.value;
if(win.elements.name == "totalCount")
totalDoc = win.elements.value;
if(win.elements.name == "offset")
offset = win.elements.value;
}
switch( kind )
{
case 1:
newOffset = 0;break;
case 2:
workInt = (offset - 0) - BlockSize;
if( workInt < 0 ) newOffset = 0;
else newOffset = workInt;break;
case 3:
workInt = (offset - 0) + (BlockSize -0);
if( totalDoc < workInt )
{
for( i=1; ;i++ )
{
workInt = 0;
workInt = (offset - 0) - (BlockSize * i);
if( totalDoc > workInt )
newOffset = workInt;break;
}
}
if( totalDoc == workInt ) newOffset = totalDoc - BlockSize;
else newOffset = workInt;break;
case 4:
for( i=1; ;i++)
{
workInt = 0;
workInt = (offset - 0) + (BlockSize * i);
if( totalDoc == workInt )
newOffset = totalDoc - BlockSize;break;
else if( totalDoc < workInt )
newOffset = workInt - BlockSize;break;
else;
}break;
default:
alert(" ***** parameter err ***** ");break;
}
for (i = 0; i < win.length; i++)
{
if (win.elements.type == "hidden")
if(win.elements.name == "offset")
win.elements.value = newOffset;
}
DocumentBoxFormSubmit( 3, win );
}

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

It does depend of how they did it.

without seen the code of the page (and even so) you can only guess, maybe
the keep in session a "current page" number, then in the html you have a
"back" and "next" which depending of which one is used post the correct
page.

what does the ChangePage method does?


cheers,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top