Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stumped - weird link problem driving me insane 1

Status
Not open for further replies.

LEICJDN1

Technical User
Nov 27, 2002
201
0
0
GB
Hi all,

I originally posted this on the CSS section as I beleived that to be the issue. Now I am not so sure.

Basically I have a little web based ASP database program I constructed to catalogue references running in Previously all worked well, but now I have a weird link problem and I do not know why it started.

Searching for a keyword produces a list of PDF file links via an ASP database query. The list is tabulated with extra information. If I click on one of the PDF links, nothing happens at all. Right click also fails. Does not even flicker or call Adobe reader. All other non-pdf links work fine.

What is really weird though, is if I view source, select all,copy and paste into my HTML editor and immediately preview in a browser it all works fine, and link opens PDF.

The ONLY difference I can disccern between the page in my application and the one generated by my HTML editor is that my page is .ASP with a querystring, and the preview from the editor is a .html file.

But how can this affect the function of the PDF links?

Weird huh? I am quitely going insane over this and cannot solve it.

Here is example code for a search result containing a PDF link:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">
<?xml version="1.0" encoding="UTF-8"?>
<head>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="Reference Manager" />
<meta name="keywords" content="Reference Manager" />

    <title>Reference Manager</title>
    <style type="text/css" media="screen">@import "style.css";</style>
    
</head>

<body>
<a name="top">
<div class="headmenu">
<h1>Reference Manager</h1>
<p>Search Results</p>
</div>

<div class="content">
<h2 style="color:black">A to Z listing</h2>
<table cellpadding="6">
<tr>
<td><a  href="asearch.asp?A">A</a></td>
<td><a   href="asearch.asp?B">B</a></td>
<td><a   href="asearch.asp?C">C</a></td>
<td><a   href="asearch.asp?D">D</a></td>
<td><a   href="asearch.asp?E">E</a></td>
<td><a   href="asearch.asp?F">F</a></td>
<td><a   href="asearch.asp?G">G</a></td>
<td><a   href="asearch.asp?H">H</a></td>
<td><a   href="asearch.asp?I">I</a></td>
<td><a   href="asearch.asp?J">J</a></td>
<td><a   href="asearch.asp?K">K</a></td>
<td><a   href="asearch.asp?L">L</a></td>
<td><a   href="asearch.asp?M">M</a></td>
<td><a   href="asearch.asp?N">N</a></td>
<td><a   href="asearch.asp?O">O</a></td>
<td><a   href="asearch.asp?P">P</a></td>
<td><a   href="asearch.asp?Q">Q</a></td>
<td><a   href="asearch.asp?R">R</a></td>
<td><a   href="asearch.asp?S">S</a></td>
<td><a   href="asearch.asp?T">T</a></td>
<td><a   href="asearch.asp?U">U</a></td>
<td><a   href="asearch.asp?V">V</a></td>
<td><a   href="asearch.asp?W">W</a></td>
<td><a   href="asearch.asp?X">X</a></td>
<td><a   href="asearch.asp?Y">Y</a></td>
<td><a   href="asearch.asp?Z">Z</a></td>
<td> &nbsp;::&nbsp; </td>
<td><a   href="asearch.asp?all">All References</a></td>
</tr>
</table>
<br />

<table cellpadding="2">
<tr>
<td><a href="search.asp" title="Search the Database">Search</a></td><td> &nbsp;::&nbsp; </td>
<td><a href="browse.asp" title="Add a new entry">Browse to add a new reference</a></td><td> &nbsp;::&nbsp; </td>
<td><a href="main.asp" title="Add a new entry">Back to start</a></td>
</tr>
</table>

    
</div>

<div class="content">
<h2 style='color:black'>Click the title to view it in a new window - hover mouse over link to view comments</h2>
<table cellpadding='5' border='0'>
<tr><td style='color:black;text-decoration:underline'><strong>Title</strong></td>
<td style='color:black;text-decoration:underline'><strong>Category</strong></td>
<td style='color:black;text-decoration:underline'><strong>Subject</strong></td>
<td style='color:black;text-decoration:underline'><strong>Author</strong></td>
<td style='color:black;text-decoration:underline'><strong>Journal</strong></td>
<td style='color:black;text-decoration:underline'><strong>Year</strong></td>
<td style='color:black;text-decoration:underline'><strong>Reference</strong></td>
<td style='color:black;text-decoration:underline'><strong>File</strong></td>
<td style='color:black;text-decoration:underline'><strong>Delete</strong></td>
<td style='color:black;text-decoration:underline'><strong>Edit</strong></td></tr>

<tr>
<td><a target='_blank' title='Comments here' href='D:\References\test.pdf'>Test entry</a></td>
<td style='color:black'>Cat</td>
<td style='color:black'>Sub</td>
<td style='color:black'>Sn</td>
<td style='color:black'>Jrnl</td>
<td style='color:black'>Year</td>
<td style='color:black'>Fullref</td>
<td style='text-transform:uppercase' style='color:black'>pdf</td>
<td><a style='color:red' href='delete.asp?683'>delete</a></td>
<td><a style='color:blue' href='edit.asp?683'>edit</a></td></tr>
</table><br />
<a href='#top'>Back to top</a>

</div>
</body>
</html>

The CSS used is this:

Code:
body {
    color:#333;
    background-color:#eee;
    margin:10px;
    padding:0px;
    font:11px verdana, arial, helvetica, sans-serif;
    }
h1 {
    margin:0px 0px 15px 0px;
    padding:0px;
    font-size:23px;
    font-weight:900;
    color:#000;
    }
h2 {
    font:bold 12px/14px verdana, arial, helvetica, sans-serif;
    margin:0px 0px 5px 0px;
    padding:0px;
    }
p {
    font:11px/20px verdana, arial, helvetica, sans-serif;
    margin:0px 0px 10px 0px;
    padding:0px;
    }
    
.Content>p {margin:0px;}
.Content>p+p {text-indent:0px;}

a {
    color:#09c;
    font-size:11px;
    font-family:verdana, arial, helvetica, sans-serif;
    font-weight:600;
    text-decoration:none;
    }
a:link {color:#09c;}
a:visited {color:#07a;}
a:hover {background-color:#eee;}

.headmenu {
    position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
    width:auto;
    margin:10px 10px 10px 0px;
    border:1px solid black;
    background-color:white;
    padding:10px;
        }
  

/* All the content boxes belong to the content class. */
.content {
    position:relative; /* Position is declared "relative" to gain control of stacking order (z-index). */
    width:auto;
    margin:10px 10px 10px 0px;
    border:1px solid black;
    background-color:white;
    padding:10px;
    z-index:3; /* This allows the content to overlap the right menu in narrow windows in good browsers. */
    }


#navAlpha {
    position:absolute;
    width:150px;
    top:148px;
    left:20px;
    border:1px dashed black;
    background-color:#eee;
    padding:10px;
    z-index:2;
    }
        
#navBeta {
    position:absolute;
    width:190px;
    top:20px;
    right:20px;
    border:1px dashed black;
    background-color:#eee;
    padding:10px;
    z-index:1;
    }

I would really appreciate input on this one! And a solution would save my sanity.
 
Sorry, forgot to add. If I right click the link and choose "save target as" that works fine, so clealry not a problem with correct link / file location etc.

Also, straight copy and paste of source into notepad and saving as html works fine!

Any ideas as to why this is happening?
 
i think the problem might be in your links, the alpha links ..

<td><a href="asearch.asp?A">A</a></td>
have a target, ok, have a querystring, ok, but the querystring has no value, unless you're using the querystring object as a whole on your target page, you're going to have an empty value to request ...

request("A") = ""
( and that goes for any other letter ) perhaps you might want to try

<td><a href="asearch.asp?A=A">A</a></td>
<td><a href="asearch.asp?A=B">B</a></td>

A being for Alpha character

then request("A") will = "A" or "B" depending on which one was clicked.

same goes for these links in your second code block :
<td><a style='color:red' href='delete.asp?683'>delete</a></td>
<td><a style='color:blue' href='edit.asp?683'>edit</a></td></tr>

and be careful of hyperlinks with querystrings, it's nice for ease of code, but you end up with a tendancy to cache the pages, even with internet settings (server and / or client side) set not to do so. if you're going to use them make sure in the target pages to include at least a <%Response.Expires=0%>


[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Perhaps something has gone wrong with the MIME map on your server, so it's sending the wrong content/type for PDFs now.
 
along genimuse's response, you could attempt a binary write page ( for testing ) thus allowing you to force the content type.. see thread "binary stream issues" (thread333-824191) for source code

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Thanks for the responses - all good stuff.

@ Drex - thanks, I had not considered that. It might explain why the ASP 'version' fails but source code as html is fine.

@Genimuse - I am not sure that is the answer as PDFs open normally from other web pages and also this one if ran as html but I will look into it.

I will report back soon..
 
what about the web server itself tho? if the mim type is set incorrectly, wouldn't it broadcast it incorrectly?

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Not if some pages from that server manage to serve PDFs fine and others not, I wouldn't think.
 
Update time.

Corrected my poor implementation of Querystring as per Drex's advice, and added Expire command.

Situation unchanged - PDF links appear, mouse changes, right click and save as works, but links do not open on left click.

Copy and paste source and save as HTMl works fine.

Time to light the fire?
 
ok .. your problem has me stumped and hooked, been searching and wondering why this situation is happening.

few things come to mind that i had as problems with a explorer style web page i built.. he's a list of similar style problems i had on my page, and hopefully the list might help you flag something down.

javascript - i dont see any in the code, but is there any you're using to launch links? there might be a minor flaw in the code, like a space in the filename and failing to put it in quotes might make it work improperly for you.

htmlencode - all data you're posting to the page, specifically in links and javascript calls make sure to htmlencode it spaces and odd characters can wreak havoc on what you're wanting vs what's happening.

querystrings - if this is a search page, and it posts/Get's back to itself, perchance the querystring is forcing a cached ( faulted ) page, instead of the changes you've put into place, or the querystring might conflict with your destionation address if it's tied into the file retrieval somehow. just for giggles, try CTRL-F5 on every page you load, even after a post, force it to clean refresh and try your links. this is the thing that's giving me a red flag in my head, your page has querystrings, your links have querystrings, and they fail, you put it into an HTML file without querystrings in the browser page and it works.

tag syntax - make sure you got </a>'s everywhere you have a <a href> ( remedial i know... ) but we all forget little things occationally and sometimes those itsy bitsy things can break everything. ( do while not rs.eof ... forgot the rs.movenext a few times )

are you using redirects of any kind? make sure your browser settings allow redirects.

quotes - single vs double quotes, i've to occation put single quotes in ASP code from JS habits, and disabled half a line of code, also handling quotes mid string and possibly breaking tag values/attributes specifically in a title attrib, then breaking the link/js action.

that's what i can think of at the moment, and should give you a few things to play with on the page for a little while. as for lighting it on fire, might not fix it but it'll make ya feel better :) more than likely it's something ridiculously small breaking the operation of the page. especially if it's only happening on PDFs and nothing else. by chance are you doing different handling on different file types?


[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Drex, thanks for your detailed reply.

Here are some more comments / observations.

I ran the output through the W3C validation and corrected a couple of minor errors but now validates fine. Problem still persists.

The querystring section is used to offer a search be letter function. There is also a seperate search form which passess data direclty to the search database section, which retrieves the recordset(s) and populates the table without querystring.

At it's most simple, the index page presents the links, and also queries the database to count the number of records and indicate the total number of references stored. The search link leads to a simple form for searching by word or author etc, posts this to another ASP page which retrieves the recordset and tabulates it.

All works fine, but the weird problem persists. I have tried indexing a file in the directory but that also 'fails' - although right click and save as is fine. I have added pdf and application/pdf to the MIME types for the root web in IIS, and ensured no ASP pages are cached.

Still does not work! Furthermore there are no redirects or javascript functions called.

I know the database queries work fine, and all the links on the page work perfectly, including those relying on querystrings, but the darn PDF links do not work - unless I paste source into an html file -with or without the CSS applied.

Problem is, it renders my prog pretty useless as I cannot simply click on a link to view the file.

Also, it did work fine until a while ago, but I cannot recall if this coincided with my updating to SP2 or any IE updates applied. Firewall is off at the moment.

I cannot fathom it. If I had access to another XP pro system I would port it across and see if it replicates.

Thanks for your help.
 
not a problem , shame it's not something publicly available to where it could be trouble-shot online

wish i could help more on the problem

let me know if anything changes
*still on notify*

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Thanks,

I do have a seperate ASP site online, so if I get time I might try uploading the whole thing there and see if problem persists.

What is most frustrating is that I cannot see any logic in the behaviour or potential reasons. Also very little - if anything at all - out there on KB or Google to help.

Doh!

Will post again if any new developments materialise.

Now, where's those matches...
 
** Update time **

Carried on trying to fathom it out with no success. Tried everything. Even ended up re-writing application.

Finally talked myself into the timing of installation of Service Pack 2 and the problem, so... bit the bullet and uninstalled SP 2 and now...



Works fine!

Bizarre - frustrated to not understand why or how, but my program now works so I am happy. Didn't really need SP2 on the laptop anyway as behind the router firewall.

Another bug for Microsoft to fix?
 
*shrugs* got me there, very glad to hear you got it working again tho.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Thanks for your help Drex, have given a star for your patience and advice.
 
follow up from another thread ( thread333-937370 ) seems the sp2 has a bad scripting host possibly, and you can install SP@ and the updated scripting engine from MS

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top