Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > "rs is nothing" doesn't seem to work

Reply
Thread Tools

"rs is nothing" doesn't seem to work

 
 
Avlan
Guest
Posts: n/a
 
      01-10-2006
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

%>

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-10-2006
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.


 
Reply With Quote
 
 
 
 
Avlan
Guest
Posts: n/a
 
      01-10-2006
Thx, that did the trick.

 
Reply With Quote
 
paul@bullschmidt.com
Guest
Posts: n/a
 
      01-10-2006
>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

 
Reply With Quote
 
Avlan
Guest
Posts: n/a
 
      01-11-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NAT doesn't seem to work on all ports gqmetro@yahoo.com Cisco 1 06-15-2005 08:26 AM
router doesn't seem to work =?Utf-8?B?ZA==?= Wireless Networking 2 06-12-2005 06:45 PM
Can't seem to get debugger to work tfs ASP .Net 1 06-28-2004 09:49 PM
Error downloading page, some pages work great but cant seem to get this one Jack Schafer Perl 1 04-23-2004 08:32 AM
&nbsp; in a ListItem doesn't seem to work Bill Green ASP .Net 2 02-07-2004 01:50 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57