473,669 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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.redire ct
"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.CreateOb ject("ADODB.con nection")
Set rsMOS = Server.CreateOb ject("ADODB.Rec ordset")
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 4512
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.redire ct "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
3159
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 server called DLLHOST.EXE has taken all the memory, and the mySQL goes off line. I close all of the record sets, and all of the Text files I read, as below
9
3657
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
25317
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 the equivalent to Nothing for a reference of type Date ?
10
3073
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, ViolationBody) End If
2
11922
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 procedure. We weren't able to declare it with DateTime.MinValue as its default value, as MinValue is a read-only property rather than a constant. To work around, we had to use a "magic date" that we checked for later on. I was never very happy...
0
1215
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 this in python? Plot.QueryBegin(datacode, None) does not work. I get a type mismatch
1
2902
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 recSet2.Fields("DateDifference") = UntilCompletion recSet2.Update As was suggested by a helpful friend at TheScripts
0
8466
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8384
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8896
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8659
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7410
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6211
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4387
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2035
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.