?
Solved

(0x80020009) Exception occurred

Posted on 2003-03-04
34
Medium Priority
?
490 Views
Last Modified: 2012-06-22
Hi there please i need help !!!!

When a request has been added to my site an email is generated to me and the supervisors.The email has a link to the website.Now the issue here is that I keep getting the error message
Error Type:
(0x80020009)
Exception occurred.
/tasksite/version1/COMMON/asp/allHP.asp, line 13

line 13 is" IF  RSLogin("user_id") <> Session("user_id")  Then  

Below is the code.

<%@ Language=VBScript %>
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/connstring.asp"-->
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/ADOVBS.INC"-->
<%


       sql = "select user_Id, user_type "
     sql =sql & "from tbl_users "
     sql = sql & "WHERE  user_id ='" & Session("user_id") & "'"
     set RSLogin = conn.execute (sql)
     
     IF  RSLogin("user_id") <> Session("user_id")  Then  
          Response.redirect "http://help/Requestsite/INDEX.asp"
     else
     'Response.write(sql)
 
           if RSLogin("user_type") = "1" then
                    Response.Redirect "../../admin/asp/adminhome.asp"
               elseif RSLogin("user_type") = "2" then
                    Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
               elseif RSLogin("user_type") = "3" then
                    Response.Redirect "../../SUPERVSR/asp/homeS.asp"
               elseif RSLogin("user_type") = "4" then
                    Response.Redirect "../../user/asp/Uhome.asp"
               else
                    Response.Redirect "http://help/Requestsite/INDEX.asp"
          end if
     end if
     
     
     %>

Thanks!!!!
0
Comment
Question by:Dilys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 12
  • 8
  • +2
34 Comments
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8065950
TheID=CInt(Session("user_id")

if RSLogin("user_id")<>TheId then


MaxOvrdrv2
0
 

Author Comment

by:Dilys
ID: 8066037
Hi MaxOvrdv2
The code above did not work still getting the error
(0x80020009)
Exception occurred.
/tasksite/version1/COMMON/asp/allHP.asp, line 16

0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8066090
Hmmn,

Microsofts knowledgebase does not have an explanation for this error that has anything do with what you have here.

What happens if you do this:

Response.write(RSLogin("user_id"))

Response.write(Session("user_id"))

Fritz the Blank
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8066097
ok... try this instead then...

if RSLogin.RecordCount<=0 then
      Response.redirect "http://help/Requestsite/INDEX.asp"
else
      rest fo the code
end if


you see... you are telling the Recordset to select from tblUsers WHERE user_id = Session("user_id").... therefore.. the recordset will be empty if the session id is not the same...

also... what type is user_id in the database??

if it is Interger/Numeric type... then there is no need for the extra commans after the = sign:

sql = sql & "WHERE  user_id =" & Session("user_id")

Let me know...

MaxOvrdrv2
0
 

Author Comment

by:Dilys
ID: 8066325
Hi Fritz
When i run your code

The userid is returned twice

IDHIDH %>
0
 

Author Comment

by:Dilys
ID: 8066358
Hi MaxOvrdrv2,

When i run your code it takes every request to the logging page and this should not be so. becasue when we have a session userid it should take the user to their welcome oage.

NOw the userid is a char field 3
I am using MSSQL 2000 DB

I think the RecordCount may have to do with it?

Thanks
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8066385
Okay, so we know that you are getting both values the way that you expect. I also see from your code that you wrote out the SQL statement and I trust that gave you what you expected. What is this about the RecordCount? I don't see it in your code...

Fritz the Blank
0
 

Author Comment

by:Dilys
ID: 8066393
Hi MaxOvrdrv2,

When i run your code it takes every request to the logging page and this should not be so. becasue when we have a session userid it should take the user to their welcome oage.

NOw the userid is a char field 3
I am using MSSQL 2000 DB

I think the RecordCount may have to do with it?

Thanks
0
 

Author Comment

by:Dilys
ID: 8066414
Fritz
when i use the recordcount function  but  it takes everyone to the login page. This should not be so if we have a session for the user. ie if the user is already logged in it should take the user to thier default welcome page.
0
 

Author Comment

by:Dilys
ID: 8066454
Fritz
when i use the recordcount function  but  it takes everyone to the login page. This should not be so if we have a session for the user. ie if the user is already logged in it should take the user to thier default welcome page.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8066504
But I don't see RecordCount in your code anywhere...

Fritz the Blank
0
 
LVL 3

Expert Comment

by:keystrokes
ID: 8066599
How about change the code to
IF  CStr(RSLogin("user_id")) <> CStr(Session("user_id"))  Then  
0
 

Author Comment

by:Dilys
ID: 8066633
Hi Fritz,
MaxOvrdrv2 told me to use it in one of his postings so i did however it now takes all everyone to the login in page.

Well below is the code revised with the recordcount method

<%@ Language=VBScript %>
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/connstring.asp"-->
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/ADOVBS.INC"-->
<%

       sql = "select user_Id, user_type "
     sql =sql & "from tbl_users "
     sql = sql & "WHERE  user_id ='" & Session("user_id") & "'"
     set RSLogin = conn.execute (sql)
     'Response.write(RSLogin("user_id"))
     'Response.write(Session("user_id"))

     
           if RSLogin.RecordCount<=0 then
                     Response.redirect "http://som-wen2/tasksite/version1/INDEX.asp"
                elseif RSLogin("user_type") = "1" then
                     Response.Redirect "../../admin/asp/adminhome.asp"
                elseif RSLogin("user_type") = "2" then
                     Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
                elseif RSLogin("user_type") = "3" then
                     Response.Redirect "../../SUPERVSR/asp/homeS.asp"
                elseif RSLogin("user_type") = "4" then
                     Response.Redirect "../../user/asp/Uhome.asp"
                else
                     Response.Redirect "../../user/asp/Uhome.asp"
           end if
     
     
     %>

     
     
     

     
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8066686
I am sorry, I didn't see that.

What if you do this instead?
if Cint(RSLogin("user_type")) > 0 then
     if RSLogin("user_type") = "1" then
          Response.Redirect "../../admin/asp/adminhome.asp"
     elseif RSLogin("user_type") = "2" then
          Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
     elseif RSLogin("user_type") = "3" then
          Response.Redirect "../../SUPERVSR/asp/homeS.asp"
     elseif RSLogin("user_type") = "4" then
          Response.Redirect "../../user/asp/Uhome.asp"
     else
          Response.Redirect "../../user/asp/Uhome.asp"
      end if
else
     Response.redirect "http://som-wen2/tasksite/version1/INDEX.asp"
end if
   
Fritz the Blank
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8066701
make sure that you are setting the Session variable in the login script...

if you are getting this (everyone gets re-directed) then that means that the session that is being set in the login never matches the one in the database...

MaxOvrdrv2
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8066719
and also... there is something wrong with the way you are using it... if you base yourself on this:

IF  RSLogin("user_id") <> Session("user_id")  Then  
         Response.redirect "http://help/Requestsite/INDEX.asp"
    else
    'Response.write(sql)

          if RSLogin("user_type") = "1" then
                   Response.Redirect "../../admin/asp/adminhome.asp"
              elseif RSLogin("user_type") = "2" then
                   Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
              elseif RSLogin("user_type") = "3" then
                   Response.Redirect "../../SUPERVSR/asp/homeS.asp"
              elseif RSLogin("user_type") = "4" then
                   Response.Redirect "../../user/asp/Uhome.asp"
              else
                   Response.Redirect "http://help/Requestsite/INDEX.asp"
         end if
    end if


then it should look like this:

IF  RSLogin.RecordCount<=0 Then  
         Response.redirect "http://help/Requestsite/INDEX.asp"
else
    'Response.write(sql)

          if RSLogin("user_type") = "1" then
                   Response.Redirect "../../admin/asp/adminhome.asp"
              elseif RSLogin("user_type") = "2" then
                   Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
              elseif RSLogin("user_type") = "3" then
                   Response.Redirect "../../SUPERVSR/asp/homeS.asp"
              elseif RSLogin("user_type") = "4" then
                   Response.Redirect "../../user/asp/Uhome.asp"
              else
                   Response.Redirect "http://help/Requestsite/INDEX.asp"
         end if
    end if

MaxOvrdrv2
0
 

Author Comment

by:Dilys
ID: 8066771
Hi Fritz,
MaxOvrdrv2 told me to use it in one of his postings so i did however it now takes all everyone to the login in page.

Well below is the code revised with the recordcount method

<%@ Language=VBScript %>
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/connstring.asp"-->
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/ADOVBS.INC"-->
<%

       sql = "select user_Id, user_type "
     sql =sql & "from tbl_users "
     sql = sql & "WHERE  user_id ='" & Session("user_id") & "'"
     set RSLogin = conn.execute (sql)
     'Response.write(RSLogin("user_id"))
     'Response.write(Session("user_id"))

     
           if RSLogin.RecordCount<=0 then
                     Response.redirect "http://som-wen2/tasksite/version1/INDEX.asp"
                elseif RSLogin("user_type") = "1" then
                     Response.Redirect "../../admin/asp/adminhome.asp"
                elseif RSLogin("user_type") = "2" then
                     Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
                elseif RSLogin("user_type") = "3" then
                     Response.Redirect "../../SUPERVSR/asp/homeS.asp"
                elseif RSLogin("user_type") = "4" then
                     Response.Redirect "../../user/asp/Uhome.asp"
                else
                     Response.Redirect "../../user/asp/Uhome.asp"
           end if
     
     
     %>

     
     
     

     
0
 

Author Comment

by:Dilys
ID: 8066995
Hi all,
I have tried everything you have written and its not working.As I said before the record count function returns every user to the logging in page.
I have verified that the userid and user-type are being generated. so I do not know what is going on.

Please help!!!!
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8067038
have you tried my latest post?

MaxOvrdrv2
0
 

Author Comment

by:Dilys
ID: 8067071
Hi MaxOvdrv2
I tried it

but i got the error below
(0x80020009)
Exception occurred.
/tasksite/version1/COMMON/asp/allHP.asp, line 16

line 16 is
IF  RSLogin("user_id") <> Session("user_id")  Then

0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8067120
I wonder if the problem isn't the line:

        Response.redirect "http://help/Requestsite/INDEX.asp"


rather than:

IF  RSLogin("user_id") <> Session("user_id")  Then  

What if you put this at the top of your page:

<%@ Language = VBScript %>
<%Response.Buffer = True%>


I know that there can be problems with the redirect if you don't have buffering enabled.

Fritz the Blank
0
 

Author Comment

by:Dilys
ID: 8067462
I placed
<%Response.Buffer = True%>
well back to square 1 takes me to the loging page and not the specifeid user pages.

0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8067479
Okay, well that is progess, because at least we found out what was causing your error. So, the good news--we know the answer to your original question, the bad news--we have a new question about why your code doesn't work as expected....

Fritz the Blank
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8067487
What happens if you use your original code but with the buffering enabled?

Fritz the Blank
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8067518
I am also wondering about this line:

 IF  RSLogin("user_id") <> Session("user_id")  Then  


Have you tried isolating this to make sure that it works? You might also try this instead:

If strComp(RSLogin("user_id"),Session("user_id"),1) = 0 then

that will compare the two strings regardless of case. If you want to make a distinction between upper and lower case, use:

If strComp(RSLogin("user_id"),Session("user_id"),0) = 0 then


Fritz the Blank
0
 
LVL 10

Assisted Solution

by:MaxOvrdrv2
MaxOvrdrv2 earned 400 total points
ID: 8067529
you AREN'T USING IT AS I ASKED!!!!

you should TAKE OUT the line that says:

IF  RSLogin("user_id") <> Session("user_id")  Then  

and REPLACE IT WITH:

IF  RSLogin.RecordCount<=0 then
      redirect
else
if RSLogin("user_type") = "1" then
                  Response.Redirect "../../admin/asp/adminhome.asp"
             elseif RSLogin("user_type") = "2" then
                  Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
             elseif RSLogin("user_type") = "3" then
                  Response.Redirect "../../SUPERVSR/asp/homeS.asp"
             elseif RSLogin("user_type") = "4" then
                  Response.Redirect "../../user/asp/Uhome.asp"
             else
                  Response.Redirect "http://help/Requestsite/INDEX.asp"
        end if
   end if

do you get what i want you to do??

****so in the end... your code should be EXACTLY the same as this:****

<%@ Language=VBScript %>
<%Response.Buffer="True"%>
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/connstring.asp"-->
<!-- #INCLUDE VIRTUAL ="taskSite/version1/inc/ADOVBS.INC"-->
<%


      sql = "select user_Id, user_type "
    sql =sql & "from tbl_users "
    sql = sql & "WHERE  user_id ='" & Session("user_id") & "'"
    set RSLogin = conn.execute (sql)


IF  RSLogin.RecordCount<=0 Then  
        Response.redirect "http://help/Requestsite/INDEX.asp"
else
   'Response.write(sql)

         if RSLogin("user_type") = "1" then
                  Response.Redirect "../../admin/asp/adminhome.asp"
             elseif RSLogin("user_type") = "2" then
                  Response.Redirect "../../SYSTEMS/asp/sysHome.asp"
             elseif RSLogin("user_type") = "3" then
                  Response.Redirect "../../SUPERVSR/asp/homeS.asp"
             elseif RSLogin("user_type") = "4" then
                  Response.Redirect "../../user/asp/Uhome.asp"
             else
                  Response.Redirect "http://help/Requestsite/INDEX.asp"
        end if
   end if

Hope this helps in clarifying...

MaxOvrdrv2
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8067576
And it would still be helpful to enable the buffering no matter what you do.

Fritz the Blank
0
 

Author Comment

by:Dilys
ID: 8067597
Thanks Everyone for your help.
I figured it out by

Checking to see if userid is blank then redirect to login page

IF Session("user_id") = "" then
     Response.redirect "http://help/INDEX.asp"
     Else
sql statement
select *
where session userid = userid
then code to display pages based on user_type.
If rslogin ..........

Well thanks everyone for your help !!!!!!
     
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 400 total points
ID: 8067645
If you look at my very first post I told you to look for that....

Fritz the Blank
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8067652
I am happy that a solution has been reached. Be sure to close this question out,

Fritz the Blank
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8071750
good thinking... see.. you're better than us... ;-) lol!

MaxOvrdrv2
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8072451
MaxOvrdrv2,

That's not what I meant!!!

I just wanted to ask why we didn't get that way earlier when I asked.

BTW, I left the information about split() and join() in the other post.

Fritz the Blank
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 8072521
no no frits.. my last post was not meant for you... :) i meant: see Dilys... you're better than us! :)

and yes... thanks for the split join info... very useful and helpful... thank you very much! :)

MaxOvrdrv2
0
 
LVL 58

Expert Comment

by:Gary
ID: 9352756
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split Points - fritz_the_blank / MaxOvrdrv2

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question