 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Dreamweaver (all versions) 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 20th, 2005, 05:41 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chapter 9 Using 'FileSystemObject'
Hey there again, sorry about this. All new to me, still learning. In the DWMX2004 book Chap 9 Page 332 'Using the FileSystemObject'. With this "Try It Out" subject I continue to get the following message when submitting a new login & password.
---------------------------------------------------------------------
Response object error 'ASP 0158 : 80004005'
Missing URL
/html/login.asp, line 49
A URL is required.
---------------------------------------------------------------------
Under the HTML folder I created a Tools folder.
In that folder I created a users.txt file.
Entered a few user names & passwords with a tab in between.
Typed all the code required. Checked it, also copied it from the folder supplied.
Continue to get the following message above.
Anything you can suggest?
Thanks again.
Mal R
Oh, the code in line 49 reads...
-----------------------------------------------------------------
47 If bUserFound = True Then
48 Session("MM_Username") = Request.Form("txtUserName")
49 Response.Redirect(sReferrer)
50 Else
51 sErrorMessage = "<span class=""clsErrorMessage""><br>" & _
52 "Login failed. Please type a valid username and password</span>"
|
|

August 20th, 2005, 05:57 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
It looks like sReferrer does not have a value.
Modify your code like this:
Code:
' Response.Redirect(sReferrer)
Response.Write("Referrer is " & sReferrer)
Response.End
What does it say?
BTW, it's better to post this in the forum targeted at the book, and not in the general Dreamweaver forum. You'll find the book's forum here.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 20th, 2005, 06:08 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Imar, it comes up with the same message.
Earlier we had the following code which was directing the successfull login to go to the required page,,,
Response.Redirect("Admin/admin.asp")
This has now gone because we created the new script.
If it helps.. http://www.timber.com/html/login.asp & http://www.timber.com/html/search.asp..
I will use the other forum in future. Tnks.
|
|

August 20th, 2005, 06:12 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Did you add the Response.End statement and comment out the Redirect line?
If so, then the error is thrown earlier. See if there is another Redirect statement earlier.
The links to the actual pages don't really help; all I get to see is the output of the page, not th actual source of the page.
Can you post the relevant bits of code?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 20th, 2005, 06:19 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry,.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
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("Tools/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(sReferrer)
Response.Write("Referrer is " & sReferrer)
Response.End
Else
sErrorMessage = "<span class=""clsErrorMessage""><br>" & _
"Login failed. Please type a valid username and password</span>"
End If
End If
End if
%>
|
|

August 20th, 2005, 06:30 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You didn't comment out
Response.Redirect(sReferrer)
so you still get the error.
sReferrer is used in the Redirect statement, but you never declared it and never gave it a value. This variable should contain the path to a file you want to redirect to. With an empty value, you'll get the error you posted earlier....
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 20th, 2005, 06:43 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Once again,. Thanx
|
|

August 20th, 2005, 07:10 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome.
What did you change to fix the problem?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

August 20th, 2005, 06:08 PM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Imar, yeh WE did. Just edited the line to read 'Response.Redirect("admin.asp") and it worked faster than you can say scrum sha delicious...
Thanks again.
Malcolm R
|
|
 |