473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

"rs is nothing" doesn't seem to work

Hi,

I'm pretty new with ASP-coding, but I got a simple login working. I let
the user enter a username and password and through a SQL-statement I
check if there is a corresponding password in the database (Yes I know,
not very good security but for the moment it's enough). Problem is that
when I enter a false user/password, I want the code to redirect to
another .asp-page which states the user is not valid. Problem lies
within the statement "if rsMOS is nothing then response.redirect
"VWGloginAgain.asp" ". Somehow, the code does not return 'nothing' but
something else.

How do I figure out what it returns? Or, how can I make sure it returns
a 'nothing' when no such password is found in the database?

Here's my code snippet ('usr' and 'ww' are defined earlier; furthermore
I've left out the redirects, but I've tested the first
if-then-conditions and they work fine... Just the 'nothing' does not
work):

<%
dim dsn
dim conn
dim rsMOS
dim strSQL

dsn="dsn=VWG"

set Conn = Server.CreateObject("ADODB.connection")
Set rsMOS = Server.CreateObject("ADODB.Recordset")
Conn.Open dsn
strSQL = "SELECT usr FROM VWGusr WHERE pw='"&ww&"'"
rsMOS.Open strSQL,Conn

if (not rsMOS is nothing) and (Not (rsMOS.BOF And rsMOS.EOF)) and usr
= "admin" then
response.write("User is admin<br>")
end if

if (not rsMOS is nothing) and (Not (rsMOS.BOF And rsMOS.EOF)) Then
response.write("User is present in DB<br>")
end if

if rsMOS is nothing Then
response.write("Usernot present, should redirect to
VWGloginAgain...<br>")
end if

rsMOS.close
set rsMOS = nothing
conn.close
set conn = nothing

%>

Jan 10 '06 #1
4 4501
Avlan wrote:
Hi,

I'm pretty new with ASP-coding, but I got a simple login working. I
let the user enter a username and password and through a
SQL-statement I check if there is a corresponding password in the
database (Yes I know, not very good security but for the moment it's
enough). Problem is that when I enter a false user/password, I want
the code to redirect to another .asp-page which states the user is
not valid. Problem lies within the statement "if rsMOS is nothing
then response.redirect "VWGloginAgain.asp" ". Somehow, the code does
not return 'nothing' but something else.


rsMOS will probably not be "nothing". Its EOF property will be true if it
did not receive any records from the sql statement you used. The only thing
you need to check for is EOF

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jan 10 '06 #2
Thx, that did the trick. :-)

Jan 10 '06 #3
>I'm pretty new with ASP-coding, but I got a simple login working. I let
the user enter a username and password and through a SQL-statement I
check if there is a corresponding password in the database (Yes I know,
not very good security but for the moment it's enough).


Seems like normal login security to me unless of course you want the
login page to use SSL and thus start with https:// instead of http://
and that of course would require a certificate.

And for a related link:

Classic ASP Design Tips - Login Page
http://www.bullschmidt.com/devtip-loginpage.asp

Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips

Jan 10 '06 #4
Well it WOULD be normal security if I would actually check the
username-password combination... At this point I only check the if the
submitted password is in the DB, regardless of username ;-)

Jan 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Graham Mattingley | last post by:
Hello Group, I have had an issue on my server for a long time and what ever I have tryed I just cant fix it. I run mySQL and IIS, and my server will crash every few days because a file on the...
9
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
13
by: John A Grandy | last post by:
apparently references of type Date can not assume the value Nothing, because the following code fails: Dim d As Date .......other code...... If d Is Nothing Then End If so then what is...
10
by: Larry Bird | last post by:
I'm trying to check for the presents of null values or null value not being present. My sample code below: If EmailAddresses Is Nothing Then SendMailMessage(EmailAddresses, AlertTitle,...
2
by: Oenone | last post by:
In our applications, we use the special value of DateTime.MinValue to represent "null dates" throughout all our code. We recently ran into an issue where we wanted an optional date parameter for a...
0
by: cfriedalek | last post by:
I'm writing a python script using win32com to call a 3rd party program via its VBS based API. In VBS a query to get some plot data goes like this: Plot.QueryBegin datacode, Nothing What is...
1
by: Kosmös Pollard | last post by:
Hey guys, I'm rather new to access and can not seem to figure out what is wrong with this code I will post below...but first...it was working perfectly fine before I added this: recSet2.Edit...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.