 |
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4  | This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040 |
Please indicate which version of the book you are using when posting questions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 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
|
|
|
|

August 26th, 2005, 09:58 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Help! Error in File System Object
I am new to Dreamweaver. Dose anyone know what I have done wrong. I keep getting a blank page with this message. Microsoft VBScript runtime error '800a0035' File not found /html/login.asp, line 18. I put some of the codes here too.
<%
Dim sErrorMessage
If Request.Form("txtUserName") <> "" And _
Request.Form("txtPassword") <> "" Then
Const ForReading = 1
Dim oFileSystemObject
Dim oTextStream
Dim sFileLocation
Dim sTempString
Dim arrTemp
Dim bUserFound
If Request.Form("btnLogin") <> "" Then
sFileLocation = Server.MapPath("users.txt")
' Create an instance of the FileSystemObject
Set oFileSystemObject = Server.CreateObject("Scripting.FileSystemObject")
' Create a reference to our text file so we can read from it
Set oTextStream = oFileSystemObject.OpenTextFile(sFileLocation, ForReading)
' Read in each line until we reach the end of the file
Do While (Not oTextStream.AtEndOfStream = True)
' Read a line
sTempString = oTextStream.ReadLine()
' If the line contains text
If Len(sTempString) > 0 Then
' The line should hold the username and password, separated by a tab
' Split the line based on a tab, so we get the username and password
' in two separate array elements
arrTemp = Split(sTempString, vbTab)
If IsArray(arrTemp) Then
' An UBound of 1 means two elements in the array, the username
' and the password. If we haven't found both, we do not continue
If UBound(arrTemp) = 1 Then
' Compare array elements with username and password
If arrTemp(0) = Request.Form("txtUserName") And _
arrTemp(1) = Request.Form("txtPassword") Then
bUserFound = True
Exit Do
End If
End If
End If
End If
Loop
' Close our textstream and clean up our objects
oTextStream.Close
Set oTextStream = Nothing
Set oFileSystemObject = Nothing
If bUserFound = True Then
Session("MM_Username") = Request.Form("txtUserName")
Response.Redirect("search.asp")
Else
sErrorMessage = "<span class=""clsErrorMessage""><br>" & _
"Login failed. Please type a valid username and password</span>"
End If
End If
End if
|
|

August 26th, 2005, 10:07 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
When and on what page do you get this error?
I see no code referring to /html/login.asp....
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 26th, 2005, 10:11 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The page you see is the login page. I am trying to get it to accept the passwords I have in a txt file so that it can go to the admin page.
Do you need more code?
|
|

August 26th, 2005, 10:18 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It's a bit odd it says FIle not found for the /html/login.asp page.
Can it not find users.txt maybe? Is that file located in the same server as the login page?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 26th, 2005, 10:25 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The login.asp is located in the HTML folder. The users.txt is outside the HTML folder. All folders are on the local and remote server.
|
|

August 26th, 2005, 10:36 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right. That's where you go wrong. Take a look at this:
Code:
sFileLocation = Server.MapPath("users.txt")
' Create an instance of the FileSystemObject
Set oFileSystemObject = Server.CreateObject("Scripting.FileSystemObject")
' Create a reference to our text file so we can read from it
Set oTextStream = oFileSystemObject.OpenTextFile(sFileLocation, ForReading)
Server.MapPath("users.txt") runs in the scope of the Login page, so it assumes users.txt lives in the same folder.
You need something like this:
sFileLocation = Server.MapPath("../users.txt")
if users.txt is one folder up from the Login page.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 26th, 2005, 10:46 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hmmm, I did try that just now,.
Changed it to sFileLocation = Server.MapPath("../users.txt") and also tried sFileLocation = Server.MapPath("Tools/users.txt"). Still got this messge
Microsoft VBScript runtime error '800a0035'
File not found
/html/login.asp, line 18
??? Not sure why.
|
|

August 26th, 2005, 11:18 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Do you think that this form may have anything to do with it???
<form method="post" name="frmLogin" class="clsErrorMessage" id="frmLogin"
onSubmit="MM_validateForm('txtUserName','','R','tx tPassword','','R');return document.MM_returnValue">
<p> </p>
<p> Then click the Login button.</p>
<p>Username<br>
<input name="txtUserName" type="text" id="txtUserName">
</p>
<p>Password<br>
<input name="txtPassword" type="password" id="txtPassword">
</p>
<p>
<input name="btnLogin" type="submit" id="btnLogin" value="Login">
</p>
<p> </p>
<p>If you are not a member yet, <a href="newsubscribe.htm">[u]Subscribe Now!</u></a></p>
<p>Need Help? <u onclick="MM_openBrWindow('forgotpassword.htm','for gotPassword','width=245,height=145')">Retreive
your lost Username and Password. </u>
</p>
</form>
|
|

August 26th, 2005, 11:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
No, I don;t think so...
Where is the Users.txt file located compared to the Login page?
Can you draw the file / directory structure?
If it's in Tools, which is at the same level as Html, try this:
Server.MapPath("../Tools/users.txt")
This goes one folder up from Html to the parent folder, and then one folder down into the Tools folder again.
HtH,
(P.S. This may be my last message for a while. Off for vacation...)
Imar
|
|

August 26th, 2005, 11:26 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I will try that. Hope your vacation is great,. Make the most of it..
THANK YOU
|
|
 |