Print Page | Close Window

Problem Linking Files In Web Page

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=27427
Printed Date: 29 March 2026 at 2:58pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Problem Linking Files In Web Page
Posted By: kennywhite
Subject: Problem Linking Files In Web Page
Date Posted: 02 June 2009 at 4:42pm
I am working on a web page where users will upload files and fill out a description of the file.
 
If there is a read me  or help file included, the user will select a check box indicating that there is more information available and type in the location of that file, which will be held on a separate file server, not the web server itself.
 
Alternatively, if there is a website that contains more information about the file, the user would type the URL into the field instead.
 
Here is the code from the page where this info is displayed.
 

<a href="<%=rs("link")%>"><%=rs("more_information")%></a>
 
If the check box on the form was selected a link appears (The check box simply puts the text "More Information" into the proper field of the datase).
 
The problem is that it points to
 
http://webserver.com/#file:%5C%5Cfileserver%5Chelp.chm" rel="nofollow - http://webserver.com/#file:\\fileserver\help.chm #
 
instead of
 
file:///%5C%5Cfileserver%5Chelp.chm" rel="nofollow - file:\\fileserver\help.chm
 
or
 
http://webserver.com/#http://google.com" rel="nofollow - http://webserver.com/#http://google.com #
 
instead of
 
http://www.google.com" rel="nofollow - http://www.google.com
 
If I change the code to
 

<a href="http://<%=rs("link")%>"><%=rs("more_information")%></a>
 
or
 

<a href="file:\\<%=rs("link")%>"><%=rs("more_information")%></a>
 
it works, but them I am limited to either just files or just web links. I don't know what to do to fix this.
 
Thanks in advance for any help!



Replies:
Posted By: cmv
Date Posted: 05 June 2009 at 9:56am
this looks like some kind of intranet ... besides it requires the user to authenticate on the fileserver.
 
i could think of a solution which stores the information about the type of the link in the recordset like this simplified example:
\\ points to a fileserver, / points to the root of the webserver, http:// points to an external link
 
strLink = rs("link").Value
If Left(strLink) = "\\" Then intType = 1 Else intType = 0
If intType = 1 Then
 strLink = "<a href=""file:\" & strLink & """>" & ...
Else
 strLink = "<a href=""" & strLink & """>" & ...
End If
Response.Write(strLink)
 
hth, christian


-------------
and remember: a CRAY is the only computer that runs an endless loop in just four hours ...


Posted By: kennywhite
Date Posted: 05 June 2009 at 8:38pm
Yes, it is an intranet site and the users are already authenticated to the fileserver.
 
I tried throwing the code in there, but I got this error message:
 
Error Type:
Microsoft VBScript compilation (0x800A03F2)
Expected identifier
/tools_update/functions.asp, line 182, column 50
strLink = "<a href=""file:\" & strLink & """>" & ...
-------------------------------------------------^
 
Any idea why?
 


Posted By: cmv
Date Posted: 06 June 2009 at 2:40pm
yes - you should finish the line (replace ...) according to your needs ;-) eg.
strLink = "<a href=""file:\" & strLink & """>" & strLink & "</a>"
hth, christian


-------------
and remember: a CRAY is the only computer that runs an endless loop in just four hours ...


Posted By: kennywhite
Date Posted: 08 June 2009 at 9:50pm
I did that and the error that I have now is:
 
Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment: 'left'
/tools_update/functions.asp, line 182



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net