 |
| HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 16th, 2005, 11:27 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Accessing files outside of IIS server
Hi All,
I have a "PDF" file which is located at "C:\TEST" folder on my server
and I am trying to open it in a new window, but I get
"The Page Cannot be Found" message.
Here is my code;
<%@language="vbscript"%>
<%option explicit%>
<%
dim strFile
' Enutxt.pdf file is located at "C:\TEST" of "SERVER01" server
strFile = "\\server01\TEST\ENUtxt.pdf"
%>
<html>
<body>
<a href="#" onclick="window.open('<%=strFile%>',
'pdf_form','height=450px,width=700px');">PDF FORM</a>
</body>
</html>
Thank you,
:)
MCinar
Love all the creatures because of the creator.
__________________
MCinar
Love all the creatures because of the creator.
|
|

March 17th, 2005, 04:01 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Unless you make a public share of the TEST folder it won't be accessible. If you did that then any files in it could be reached via file explorer as well. Instead you could make a new virtual directory on the server pointing at c:\test, called "VirtualTest" for example and use the path: /virtualTest/enutxt.pdf.
--
Joe ( Microsoft MVP - XML)
|
|

March 17th, 2005, 11:12 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I will try it.
Thank you, Joe.
MCinar
Love all the creatures because of the creator.
|
|

March 17th, 2005, 10:52 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Joe,
I tried your solution and it worked very well.
Thanks again for your help.
I have more one question;
What is the syntax of passing multiple values in the following code? This code works with passing one value, but if I want to include a second value.
Lets say "User=ADMIN" pair. What would be the syntax?
<script language="javascript">
function update_onclick(lngCorpID)
{
document.location.href="update_billing.asp?
Corp_ID=" + lngCorpID;
)
</script>
Thanks
MCinar
Love all the creatures because of the creator.
|
|

March 18th, 2005, 07:33 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Code:
function update_onclick(lngCorpID, UserName)
{
document.location.href="update_billing.asp?
Corp_ID=" + lngCorpID + "&USER=" + UserName;
)
If there is any chance that that your parameters will have non ascii characters you must encode them. In IE use EncodeURIComponent function, otherwise use escape function.
Code:
function update_onclick(CorpId, UserName)
{
var sParams = "?Corp_Id=" + EncodeURIComponent(CorpId) + "&User=" + EncodeURIComponent(UserName);
document.location.href = "update_billing.asp" + sParams;
}
--
Joe ( Microsoft MVP - XML)
|
|

March 18th, 2005, 11:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thank you, Joe.
It is very helpful.
MCinar
Love all the creatures because of the creator.
|
|

April 4th, 2005, 08:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hi Joe,
I have a virtual directory in IIS called "Billing" and it points to
"D:\Billing" folder. It is outside of IIS drive.
If I try to open a PFD file in this folder, I can do it.
But if I try to access a "Text" file to read it by using
"Scripting.FileSystemObject", it generates the following error;
Error Type:
Microsoft VBScript runtime (0x800A004C)
Path not found
/lettertemplates/mc_filescript_2.asp, line 8
Here is my code;
<%
dim objFSO, objFileText, strPath, strLineText, strSourceFile
strSourceFile = "File1.txt"
strPath = "/Billing/" & strSourceFile
set objFSO = server.CreateObject("Scripting.FileSystemObject")
set objFileText = objFSO.OpenTextFile(strPath, 1, false)
' read one line at a time
do while not objFileText.AtEndOfStream
strLineText = objFileText.readline
response.Write strLineText
loop
set objFSO = nothing
set objFileText = nothing
%>
Thanks for your help,
MCinar
Love all the creatures because of the creator.
|
|

April 6th, 2005, 04:17 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi MCinar,
What's wrong with this forum and this post that you decided to send this question to me directly? Aren't you getting the answers you need?
Did you read my bio on my Profile page?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

April 6th, 2005, 07:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
I just read your bio on profile page, otherwise I wouldn't send it to you.
You have been always helpful.
Thank you,
MCinar
Love all the creatures because of the creator.
|
|

April 7th, 2005, 01:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That seems to contradict as I asked to consider posting a question *here* instead of sending it to me directly. IMO, there's no reason why a post here doesn't suffice.... You'd be surprised by the number of questions like this I receive in my Inbox, so I'd like to minimize that as much as possible. I'll auto-forward them to you if you want.... ;)
Anyway, you should pass a true path to objFSO.OpenTextFile, either by using Server.MapPath(strPath) or by using a fixed path like "C:\WhatEver\SomeFolder\SomeFile.txt"
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |