Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 20th, 2005, 05:41 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>"
Reply With Quote
  #2 (permalink)  
Old August 20th, 2005, 05:57 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
Reply With Quote
  #3 (permalink)  
Old August 20th, 2005, 06:08 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
  #4 (permalink)  
Old August 20th, 2005, 06:12 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
Reply With Quote
  #5 (permalink)  
Old August 20th, 2005, 06:19 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
%>

Reply With Quote
  #6 (permalink)  
Old August 20th, 2005, 06:30 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
Reply With Quote
  #7 (permalink)  
Old August 20th, 2005, 06:43 AM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Once again,. Thanx

Reply With Quote
  #8 (permalink)  
Old August 20th, 2005, 07:10 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You're welcome.

What did you change to fix the problem?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #9 (permalink)  
Old August 20th, 2005, 06:08 PM
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the FileSystemObject malhyp Dreamweaver (all versions) 1 October 2nd, 2005 07:00 AM
I need help with FileSystemObject ... PLEASE xanderxvr Classic ASP Professional 0 January 31st, 2005 02:56 AM
FileSystemObject dikkjo Classic ASP Components 2 October 15th, 2003 06:50 AM
FileSystemObject Gennady Classic ASP Components 6 June 17th, 2003 08:16 AM



All times are GMT -4. The time now is 06:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.