View Full Version : default property not found??
cabflex
07-16-2003, 08:47 PM
greetings all
i have a simple asp / MS access login script that is working fine on another site i have up on the net, ive adjusted it to run on a new site that im busy with (hosted on the same server), im in the testing phases, and every time i run the login script, i get the error :
'a default property was not found for the object'
all i have changed is the path to the database, so i really cant see why it shouldnt be working...
has anyone had a similar experience that could point me in the right direction???
thanks !
Can you post the relevant code (the line the eror points to + related code) ?
cabflex
07-16-2003, 10:03 PM
Hey
okay i managed to fix the default property not found problem, but now the script doesnt redirect me to members_area.htm when an email address that is in the database and correlates to strUserName (which i hardcoded for now) is entered...rather it directs me to unauthorised_user_page.htm
here is the code, any ideas??
Thanks
<%
Dim adoCon
Dim strCon
Dim rsCheckUser
Dim strAccessDB
Dim strSQL
Dim strUserName
'Initalise the strUserName variable
strUserName = "k"
strAccessDB = "hed_db"
Set adoCon = Server.CreateObject("ADODB.Connection")
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=letmein; DBQ=" & Server.MapPath(strAccessDB)
adoCon.Open strCon
Set rsCheckUser = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT hed_table.email FROM hed_table WHERE hed_table.name ='" & strUserName & "'"
rsCheckUser.Open strSQL, strCon
If NOT rsCheckUser.EOF Then
If (Request.Form("email")) = rsCheckUser("email")
Then
Session("blnIsUserGood") = True
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing
Response.Redirect "../members_area.htm"
End If
End If
'Close Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing
'If the script is still running then the user must not be authorised
Session("blnIsUserGood") = False
'Redirect to the unautorised user page
Response.Redirect"unauthorised_user_page.htm"
%>
I think you shoudl get an error here
If (Request.Form("email")) = rsCheckUser("email")
Then
The then should be on the previous line. Maybe that is the problem.
Try
If rsCheckUser.EOF = True Then
Session("blnIsUserGood") = False
response.Redirect"unauthorised_user_page.htm"
strCon.close
Set strCon = Nothing
rsCheckUser.close
Set rsCheckUser = Nothing
response.end
else
If (Request.Form("email")) = rsCheckUser.Fields("email") Then
Session("blnIsUserGood") = True
strCon.close
Set strCon = Nothing
rsCheckUser.close
Set rsCheckUser = Nothing
Response.Redirect "../members_area.htm"
End If
End If
Is this parent reference (../) necessary ? It'll not work on most well configured servers (that turn of parrent referencing for security reasons.
This also looks strange to me
Set adoCon = Nothing
Set strCon = Nothing
Set rsCheckUser = Nothing
I'd use
strCon.close
Set strCon = Nothing
rsCheckUser.close
Set rsCheckUser = Nothing
cabflex
07-16-2003, 11:01 PM
okay cool, now when i run the script my browser loads the asp page : ie. http://www.raygun.co.za/dope/database/user_access3.asp in the address bar, but it's a blank page ... ?
its not redirecting to the members_area or unauthorised page
--thanks for the parent reference tip, i was unaware of that, nice one
cabflex
07-17-2003, 12:16 AM
any idea why raf?
scroots
07-17-2003, 12:26 AM
do you have any content that is not within ASP tafs or is written out by ASP to the page? if not that is why it is blank
scroots
The link you posted, is that the code from the code for the usercheck, or is that the page that is redirected to ?
cabflex
07-17-2003, 09:00 AM
thats the code for the user check, that page is supposed to redirect to one of 2 pages depending on what is entered into the 'email field on the login form'...
So there's something wrong. :D
Put this on top of the page
<%response.buffer = True%>
Slip in some comments at strategic points. Like
respons.write ("Authorised, now redirect ?")
response.Flush
right before the redirect.
or
respons.write ("Validation chek now?")
response.Flush
richt before the first 'if'
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.