Bookmarked URL Works, Saved URL String Doesn't 
Author Message
 Bookmarked URL Works, Saved URL String Doesn't

I'm confused.

I bookmarked a URL in Firefox.  When the bookmark is selected the Web page
appears.   if I copy the URL string and past it back into Firefox
immediately after copy, it works.

However, if I save the URL string and then copy/paste it back into Firefox -
or -  use if with API: InternetOpen, the Web page fails to appear and errors
with "The requested URLwas not found on this server."

Any suggestions or why?



Sat, 04 Feb 2012 02:15:06 GMT  
 Bookmarked URL Works, Saved URL String Doesn't

Quote:
> I'm confused.

> I bookmarked a URL in Firefox.  When the bookmark is selected the Web page
> appears.   if I copy the URL string and past it back into Firefox
> immediately after copy, it works.

> However, if I save the URL string and then copy/paste it back into
> Firefox - or -  use if with API: InternetOpen, the Web page fails to
> appear and errors with "The requested URLwas not found on this server."

Is this a VB question? InternetOpen always use IE regardless of the default
browser.


Sat, 04 Feb 2012 02:33:54 GMT  
 Bookmarked URL Works, Saved URL String Doesn't
Post  was made to explain that "InternetOpen" failed -- but -- so does
manual browser url string usage (Firefox).

Not sure how to proceed as --  doesn't appear to be a VB code problem (using
same VB code that works fine with a different URL)?

If not VB Question where should I post?.

Why would string placed on clipboard and immediately used work --
yet -- saved string fail?


Quote:


>> I'm confused.

>> I bookmarked a URL in Firefox.  When the bookmark is selected the Web
>> page appears.   if I copy the URL string and past it back into Firefox
>> immediately after copy, it works.

>> However, if I save the URL string and then copy/paste it back into
>> Firefox - or -  use if with API: InternetOpen, the Web page fails to
>> appear and errors with "The requested URLwas not found on this server."

> Is this a VB question? InternetOpen always use IE regardless of the
> default browser.



Sat, 04 Feb 2012 03:43:53 GMT  
 Bookmarked URL Works, Saved URL String Doesn't

Quote:

>I bookmarked a URL in Firefox. When the bookmark is selected the Web
>page appears. if I copy the URL string and past it back into Firefox
>immediately after copy, it works.

>However, if I save the URL string and then copy/paste it back into
>Firefox - or - use if with API: InternetOpen, the Web page fails to
>appear and errors with "The requested URLwas not found on this server."

Well, InternetOpen doesn't take a URL, so that's problem #1.

I suppose it's possible the server is doing some user-agent sniffing and
responding differently for different user agents. It's also possible you
have a bug.

Can you post a concise and complete code example that demonstrates the
bug?

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
   Luck is probability taken personally.
   -- Chip Denman



Sat, 04 Feb 2012 04:24:24 GMT  
 Bookmarked URL Works, Saved URL String Doesn't
OK Scott:  This is part of the function for getting the Web Page.
A complete example is quite a lot of code to post here.

==============
   'get the handle of the current internet connection
    hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)

    'get the handle of the url
    If hSession Then hInternet = InternetOpenUrl(hSession, sURL,
vbNullString, 0, IF_NO_CACHE_WRITE, 0)

    'if we have the handle, then start reading the web page
    'More Code here
=================

I know the above works as I use it to obtain other URL's and pages.
I get  -- what appears -- to be a valid "hSession" handle and a valid
"hInternet" handle.

Just the server is NOT returning the desired URL page, but instead an URL
error page.

The above code should be the same as using the browser directly.
Hence my attempt at copying and pasting into the browser textbox window both
the Firefox bookmark URL and the same URL string saved elsewhere.
Furthermore,  I have manually compared the URL strings both visually and
with a HEX editor and there is NO difference.

Consequently, I don't understand why the server would recognize one
(bookmark invoked URL) and not the other (saved string)?


Quote:

>>I bookmarked a URL in Firefox. When the bookmark is selected the Web
>>page appears. if I copy the URL string and past it back into Firefox
>>immediately after copy, it works.

>>However, if I save the URL string and then copy/paste it back into
>>Firefox - or - use if with API: InternetOpen, the Web page fails to
>>appear and errors with "The requested URLwas not found on this server."

> Well, InternetOpen doesn't take a URL, so that's problem #1.

> I suppose it's possible the server is doing some user-agent sniffing and
> responding differently for different user agents. It's also possible you
> have a bug.

> Can you post a concise and complete code example that demonstrates the
> bug?

> --
> --------- Scott Seligman <scott at <firstname> and michelle dot
> net> ---------
>   Luck is probability taken personally.
>   -- Chip Denman



Sat, 04 Feb 2012 05:56:32 GMT  
 Bookmarked URL Works, Saved URL String Doesn't


Quote:
> OK Scott:  This is part of the function for getting the Web Page.
> A complete example is quite a lot of code to post here.
<..>
> I know the above works as I use it to obtain other URL's and pages.
> I get  -- what appears -- to be a valid "hSession" handle and a valid
> "hInternet" handle.

> Just the server is NOT returning the desired URL page, but instead an URL
> error page.

Just as a test, you could event sync an instance of IE and monitor its
BeforeNavigate2 event to see if anything else is being sent to the server
besides the URL.  (eg, Flags, PostData, Headers, etc...)

LFS



Sat, 04 Feb 2012 09:59:25 GMT  
 Bookmarked URL Works, Saved URL String Doesn't

Quote:
>    hSession = InternetOpen("vb wininet", 1, vbNullString, vbNullString, 0)

As far as the web server is concerned, the user agent string indicates it's
not a browser, perhaps some sort of random web bot called "vb wininet".


Sat, 04 Feb 2012 11:35:16 GMT  
 Bookmarked URL Works, Saved URL String Doesn't
  This may be more work than you want to get
into... but you don't have to be limited to IE
wrapper functions. See here for a userControl
that encapsulates direct API calls, using winsock
to talk to the server directly:

www.jsware.net/jsware/vbcode.php5#htp

  Instead of using IE it allows you to carry out
the server conversation, preparing the header
yourself, responding to server feedback, etc. It's
more work, though. And there can be additional
complications, like occasional gzip-ed pages.

  As others have said, the server response can vary
depending on the userAgent. A lot of pages will
have script included that accomodates different
browsers, but PHP (and I think ASP) pages will
often construct different pages for different browsers.
Also, using a .htaccess file (Unix/Linux servers)
allows actions can be taken based on your IP, your
userAgent, etc. bfore a page is served.

  It could be that the site is checking for IE/Firefox/
Opera etc. and then quitting if it can't recognize the
browser. (That would be rather odd behavior, though.)

   It's easy to test that in Firefox. Add a line to user.js
in the profile folder. (Create user.js if necessary.) The
profile folder will be the one in App Data\Mozilla\Firefox
\Profiles\[random name] that contains prefs.js.
The line should be like this....

user_pref("general.useragent.override", "Mozilla/5.0 (Windows XP; SV1;)
Gecko Firefox");

or like this...

user_pref("general.useragent.override", "TestUAStringHere");

  You can find lists of typical userAgent strings online if
you want to spoof different browsers.



Sat, 04 Feb 2012 12:45:59 GMT  
 Bookmarked URL Works, Saved URL String Doesn't
Thanks Larry, Nobody and  mayayana

Oddly enough, program now works.

Only thing I changed was to include a trailing blank on the URL
string I pass to the server.  Can't believe it -- as you would think all
trailing blanks would be "trimmed".

Have a nice day all

David


Quote:
>  This may be more work than you want to get
> into... but you don't have to be limited to IE
> wrapper functions. See here for a userControl
> that encapsulates direct API calls, using winsock
> to talk to the server directly:

> www.jsware.net/jsware/vbcode.php5#htp

>  Instead of using IE it allows you to carry out
> the server conversation, preparing the header
> yourself, responding to server feedback, etc. It's
> more work, though. And there can be additional
> complications, like occasional gzip-ed pages.

>  As others have said, the server response can vary
> depending on the userAgent. A lot of pages will
> have script included that accomodates different
> browsers, but PHP (and I think ASP) pages will
> often construct different pages for different browsers.
> Also, using a .htaccess file (Unix/Linux servers)
> allows actions can be taken based on your IP, your
> userAgent, etc. bfore a page is served.

>  It could be that the site is checking for IE/Firefox/
> Opera etc. and then quitting if it can't recognize the
> browser. (That would be rather odd behavior, though.)

>   It's easy to test that in Firefox. Add a line to user.js
> in the profile folder. (Create user.js if necessary.) The
> profile folder will be the one in App Data\Mozilla\Firefox
> \Profiles\[random name] that contains prefs.js.
> The line should be like this....

> user_pref("general.useragent.override", "Mozilla/5.0 (Windows XP; SV1;)
> Gecko Firefox");

> or like this...

> user_pref("general.useragent.override", "TestUAStringHere");

>  You can find lists of typical userAgent strings online if
> you want to spoof different browsers.



Sun, 05 Feb 2012 01:25:12 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Extract URL Links from Page, Navigate to these URL's and Extract E-Mail

2. Saving Multiple URL's

3. Saving Multiple URL's

4. Saving Multiple URL's

5. how does detect url's work?

6. how to use url.Encode for NS problem w/ params in URL

7. URL, Getting the url using asp

8. Navigate an URL and get URL result in COM object

9. Invalid URL form or fully-qualified absolute URL was used

10. Finding URL from a .url file

11. Save Record doesn't work ?

12. fRefreshLinks Doesn't work if path doesn't exist

 

 
Powered by phpBB® Forum Software