dba123
asked on
Refresh problem with variables
1st link - my main.asp page
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcT4ziUBKsDwygOf&.dir=/EE&.dnm=main.asp&.src=bc
2nd link - is an include file contained within my main.asp page which I have simply renamed to be "include_asp_page.asp" for privacy concerns. In this file, you'll see the variables in there where I specify if the resource is full or not
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcT4ziUBMe6MF_hB&.dir=/EE&.dnm=include_asp_page.txt&.src=bc
what's happening is hidebutton, resourcefull, etc. is not showing new values unless I refresh manually after I click the jpg to remove the user in the '####### Show Who is using this resource section. The selects are bringing back correct info for stuff but my If statements dealing with the variables resourcefull, hidebutton, etc. is the problem because they are not refreshing (calling the functions again) after I remove a user (Expire a user).
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcT4ziUBKsDwygOf&.dir=/EE&.dnm=main.asp&.src=bc
2nd link - is an include file contained within my main.asp page which I have simply renamed to be "include_asp_page.asp" for privacy concerns. In this file, you'll see the variables in there where I specify if the resource is full or not
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcT4ziUBMe6MF_hB&.dir=/EE&.dnm=include_asp_page.txt&.src=bc
what's happening is hidebutton, resourcefull, etc. is not showing new values unless I refresh manually after I click the jpg to remove the user in the '####### Show Who is using this resource section. The selects are bringing back correct info for stuff but my If statements dealing with the variables resourcefull, hidebutton, etc. is the problem because they are not refreshing (calling the functions again) after I remove a user (Expire a user).
ASKER
no, makes no difference. I already had response.expires = 0, took that out and tried -1, doesn't matter. I have to refresh twice for those variables. Did you take a look at my code? I'm not talking about query data, I'm talking about the functions that are assigned to my hidebutton and the other variables I"m talking about such as resourcefull
ASKER
in fact, your -1 made it worse :(
are you able to run this code in debug mode and step through the code to see why those variables are not getting populated when you want them to? I did look at your code, but that is quite a bit to wade through to try to understand what all that code is doing. If it were me, I would set a breakpoint and then step through the code to try to understand why the functions in question are not firing when you expect them to, or if they are why they are not returning what you want them to...
jk
jk
ASKER
It's almost like one part of the form is being refreshed and the other isn't because I notice that the function calls in my main asp for the jpgs which are shown by running the function StatusColor(Session("Emplo yeeID"), ResourceID) as you can see in my main.asp works fine but then if I assign a variable to = a function result in my include page, it doesn't work unless I refresh.
the StatusColor(Session("Emplo yeeID"), ResourceID) simply does this...and is not assigned to a variable (if you review my main.asp) page:
Function StatusColor(EmployeeID, ResourceID)
....does some stuff here and then assignes a string, just a jpg to show
Select Case status
Case "open"
strSQL3 = strSQL3 & ", @Status=" & 1 'Open
Set Query3 = objConnection.Execute(strS QL3)
StatusColor = "<img src=""images/gr.gif"" border=""0"">"
Case "full"
strSQL3 = strSQL3 & ", @Status=" & 2 'Full
Set Query3 = objConnection.Execute(strS QL3)
StatusColor = "<img src=""images/rd.gif"" border=""0"">"
Case "me"
StatusColor = "<img src=""images/bg.gif"" border=""0"">"
Case "me_full"
strSQL3 = strSQL3 & ", @Status=" & 2 'Full
Set Query3 = objConnection.Execute(strS QL3)
StatusColor = "<img src=""images/rb.gif"" border=""0"">"
End Select
End Function
so why does the function work in my main.asp but when I try other functions and assign them to the variables in my include do I have to refresh in order for those variables to recalculate....or in other words invoke the functions those variables are calling? The Query info it is bringing back is working fine in my include page, just not the functions that are assigned to those variables hidebutton, resourcefull, etc.
Somone has to know here, I sure don't ...please do take a look at the 2 links which stand for my main page and include page and the variables I'm talking about here....not sure what else to do!!!
the StatusColor(Session("Emplo
Function StatusColor(EmployeeID, ResourceID)
....does some stuff here and then assignes a string, just a jpg to show
Select Case status
Case "open"
strSQL3 = strSQL3 & ", @Status=" & 1 'Open
Set Query3 = objConnection.Execute(strS
StatusColor = "<img src=""images/gr.gif"" border=""0"">"
Case "full"
strSQL3 = strSQL3 & ", @Status=" & 2 'Full
Set Query3 = objConnection.Execute(strS
StatusColor = "<img src=""images/rd.gif"" border=""0"">"
Case "me"
StatusColor = "<img src=""images/bg.gif"" border=""0"">"
Case "me_full"
strSQL3 = strSQL3 & ", @Status=" & 2 'Full
Set Query3 = objConnection.Execute(strS
StatusColor = "<img src=""images/rb.gif"" border=""0"">"
End Select
End Function
so why does the function work in my main.asp but when I try other functions and assign them to the variables in my include do I have to refresh in order for those variables to recalculate....or in other words invoke the functions those variables are calling? The Query info it is bringing back is working fine in my include page, just not the functions that are assigned to those variables hidebutton, resourcefull, etc.
Somone has to know here, I sure don't ...please do take a look at the 2 links which stand for my main page and include page and the variables I'm talking about here....not sure what else to do!!!
ASKER
>>>are you able to run this code in debug mode and step through the code to see why those variables are not getting populated when you want them to?
yea, I did respones.writes to write out my variables right before they are evaluated...and noticed it was keeping the old results...that's why I am posting this problem in the first place. I have to refresh for it to recalculate. It isn't something that's wrong with my functions rather maybe the placement of my variables and calls but I've already tried to move them around before those variables are evaluated.
yea, I did respones.writes to write out my variables right before they are evaluated...and noticed it was keeping the old results...that's why I am posting this problem in the first place. I have to refresh for it to recalculate. It isn't something that's wrong with my functions rather maybe the placement of my variables and calls but I've already tried to move them around before those variables are evaluated.
ASKER
all you need to do for me is look at a few things...ignore the rest of my code:
1) Look at my main. All this does is throws out information and a link for each
2) Look at my form action..the URL I have associated to the form both in my main.asp and include page...is that causing the problem?
3) Look at a couple function specifically AddUser or Expire....those are the things that are invoked when I am doing stuff on the include page and they have redirects...maybe this is causing it
4) Look at this section specifically in reference to where the problem is happening in my include page:
Dim hidebutton, hidebutton2, resourcefull
hidebutton = 0
hidebutton2 = 0
resourcefull = 0
hidebutton = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 1)
hidebutton2 = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 2)
resourcefull = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 2)
Response.Write("<tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"">" & vbCrLf)
Response.Write(" <form action=""/sss/main.asp?act ion=gethar ddesc&hid= " & Session("ResourceID") & """ method=""post"" name=""request"">" & vbCrLf)
Response.Write(" <input type=""hidden"" name=""write"" value=""request"">" & vbCrLf)
requested = 0
requested = CheckRequested(Session("Em ployeeID") , Session("ResourceID"))
If hidebutton = 0 AND hidebutton2 = 1 AND resourcefull <> 2 AND requested <> 1 Then
Response.Write(" <br><input type=""submit"" name=""requestspace"" value=""Request To Use This Resource"" class=""submitbutton""><br ><br>" & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
Response.Write("</tr>" & vbCrLf)
If resourcefull = 2 Then
Response.Write("<tr>" & vbCrLf)
Response.Write(" <td align=""center"" valign=""top"" class=""full"">This resource is currently FULL</td>" & vbCrLf)
Response.Write("</tr>" & vbCrLf)
Response.Write("<tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"" class=""full_sm"">*There is a 30 gig safety net for any <br>resource with total disk space > 50 gigs<br>*There is a 10 gig safety for any <br>resource with total disk space of < 50 gigs" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write("</tr>" & vbCrLf)
End If
Point #4 is where my problem lies. It should not be saying "This resource is Full" and it isn't. I have to refresh in order for resourcefull variable to ring home the true value which is currently calculated if the function behind resoucefull (ResDetailButtons(Session( "EmployeeI D"), Session("ResourceID"), 2)
) is run
1) Look at my main. All this does is throws out information and a link for each
2) Look at my form action..the URL I have associated to the form both in my main.asp and include page...is that causing the problem?
3) Look at a couple function specifically AddUser or Expire....those are the things that are invoked when I am doing stuff on the include page and they have redirects...maybe this is causing it
4) Look at this section specifically in reference to where the problem is happening in my include page:
Dim hidebutton, hidebutton2, resourcefull
hidebutton = 0
hidebutton2 = 0
resourcefull = 0
hidebutton = ResDetailButtons(Session("
hidebutton2 = ResDetailButtons(Session("
resourcefull = ResDetailButtons(Session("
Response.Write("<tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"">" & vbCrLf)
Response.Write(" <form action=""/sss/main.asp?act
Response.Write(" <input type=""hidden"" name=""write"" value=""request"">" & vbCrLf)
requested = 0
requested = CheckRequested(Session("Em
If hidebutton = 0 AND hidebutton2 = 1 AND resourcefull <> 2 AND requested <> 1 Then
Response.Write(" <br><input type=""submit"" name=""requestspace"" value=""Request To Use This Resource"" class=""submitbutton""><br
End If
Response.Write(" </td>" & vbCrLf)
Response.Write("</tr>" & vbCrLf)
If resourcefull = 2 Then
Response.Write("<tr>" & vbCrLf)
Response.Write(" <td align=""center"" valign=""top"" class=""full"">This resource is currently FULL</td>" & vbCrLf)
Response.Write("</tr>" & vbCrLf)
Response.Write("<tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"" class=""full_sm"">*There is a 30 gig safety net for any <br>resource with total disk space > 50 gigs<br>*There is a 10 gig safety for any <br>resource with total disk space of < 50 gigs" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write("</tr>" & vbCrLf)
End If
Point #4 is where my problem lies. It should not be saying "This resource is Full" and it isn't. I have to refresh in order for resourcefull variable to ring home the true value which is currently calculated if the function behind resoucefull (ResDetailButtons(Session(
) is run
I am not talking about doing response.writes, but rather to debug and "step through" your code. I am not sure what program you are using to write your code, but if you are using InterDev or something like that you should be able to set a breakpoint and then begin stepping through the code one line at a time. When you get to the statment that calls the function when it is returning the "stale" value, then you could step into that function and determine why it is returning the old value. Do you have the ability to do that?
ASKER
I'm using straight coding...Textpad...I don't use Interdev and don't prefer to.
ASKER
It's something simple here...it's not my functions rather how I have my page organized probably but I don't know what it is.
I am looking at your two pages of code, but cannot find the code for the ResDetailButtons function...what page is it on? If I understand your above messages correctly, that is the function that is returning a '2', which is giving you the incorrect value.
the reason I asked you if you could step through your code is because you would be able to follow code execution into the functions and see why it is returning a bad value before you refresh...
It would be an interesting test if you could copy all of that code from your include into your main.asp and remove the dependence on the include (just for testing) and see if it works without having to do the refresh.
the reason I asked you if you could step through your code is because you would be able to follow code execution into the functions and see why it is returning a bad value before you refresh...
It would be an interesting test if you could copy all of that code from your include into your main.asp and remove the dependence on the include (just for testing) and see if it works without having to do the refresh.
ASKER
that is in another include, my functions include as you will see at the top of main.asp...I didn't post that in here, Here it is:
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcyd8iUB5MHTgQxY&.dir=/EE&.dnm=functions_include.txt&.src=bc
I have a function includes and this is where that f unction resides. I just put that function in this file just so you can take a look at it.
I'll tried just pasting it straight into my include page but it made no difference.
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcyd8iUB5MHTgQxY&.dir=/EE&.dnm=functions_include.txt&.src=bc
I have a function includes and this is where that f unction resides. I just put that function in this file just so you can take a look at it.
I'll tried just pasting it straight into my include page but it made no difference.
ASKER
the function works just fine. The problem is that if I refresh, the function runs again and is no longer 2 after I delete a user which is what it should be, it should not longer be 2 but....the resourcefull variable is causing the issue here...it is still holding the last value that the function brought back last time, it is not clearing after a Response.Redirect lets say from the Expire function for example where I do the response.redirect. If I do a redirect, it should clear whatever value was in the resourcefull variable right? well it isn't because after I expire a user, that value changes to 1 if I refresh which is completely correct because that record no longer exists and the function rightly returns 1...only if I manually click refresh...
This is what's happening once again:
1) The page loads, including main.asp and the include page
2) At this point, the variable resourcefull = 2 (result of the ran function)
2) I Expire a user
3) It should no longer say "This resource is Full" but it does after my Response.Redirect from the Expire function is done...because my resourcefull variable is still saying 2. I even put a resourcefull = 0 right before it calls the function hoping to clear it but it doesn't
4) I have to manually click refresh
5) Now my resourcefull variable is showing a correct value - 1
This is what's happening once again:
1) The page loads, including main.asp and the include page
2) At this point, the variable resourcefull = 2 (result of the ran function)
2) I Expire a user
3) It should no longer say "This resource is Full" but it does after my Response.Redirect from the Expire function is done...because my resourcefull variable is still saying 2. I even put a resourcefull = 0 right before it calls the function hoping to clear it but it doesn't
4) I have to manually click refresh
5) Now my resourcefull variable is showing a correct value - 1
ASKER
I should not have to manually click refresh is the whole point here in order to clear out the last returned value of resourcefull variable....why is this happening!!! Why does it seem that the function ResDetailButtons is not being really run the second time after the redirect from my Expire Sub unless I manually click Refresh on my browser??
>>> I'll tried just pasting it straight into my include page but it made no difference.
I would like to see what happens if you remove all of your dependencies on includes...I am thinking that your problem has something to do with the having those includes and the flow of your page. You stated that you pasted "straight into your include page", but have you tried pasting the code from your includes into your main.asp page and see what happens?
I would like to see what happens if you remove all of your dependencies on includes...I am thinking that your problem has something to do with the having those includes and the flow of your page. You stated that you pasted "straight into your include page", but have you tried pasting the code from your includes into your main.asp page and see what happens?
ASKER
Hold on a sec.......AHHHHHHHHHHHHHHH HHHHHHHHHH
ok, I am so frustrated, I know it's something simple here.
ok, I am so frustrated, I know it's something simple here.
ASKER
I just did your suggestion, made my include no longer an include in my main.asp....did not have any affect. Inclues shouldn't matter, it is the same as pasting it in anyway.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
1) Yes it is...again, if I refresh, all that is doing is running a stored proc to check a field. It works when I refresh and it all has to do with deleting the epired record. The record is indeed deleted when I do it. So that function works for sure...I konw it 100%
2)Might want to response.write the value of your status out so you can see it.
Just tried it, same thing is happening. I wrote out Query("Status") and again, it remains 2 until I refresh...doesn't make any difference. The record is correct and that is why I am only running the 2nd portion of my sub, that is how it works. The record's status is indeed 1, not 2 but I have to refresh to get that function to requery the database and prove it. This is not a timing issue...that record is deleted instantly, I verified.
2)Might want to response.write the value of your status out so you can see it.
Just tried it, same thing is happening. I wrote out Query("Status") and again, it remains 2 until I refresh...doesn't make any difference. The record is correct and that is why I am only running the 2nd portion of my sub, that is how it works. The record's status is indeed 1, not 2 but I have to refresh to get that function to requery the database and prove it. This is not a timing issue...that record is deleted instantly, I verified.
ASKER
I suppose I could put a 5 second delay in there after the record is deleted...how can I do this?
ASKER
hold on, I'll put in a delay at the end of my Expire function, which is right after the record is deleted and right before it is about to call the ResDetailButtons function
ASKER
I'm telling you it is working fine. I wrote out the status, checked the DB every time. The function is fine, the value is fine for the record the function is pulling.
ASKER
I even did this in my ResDetailButtons function just to prove that the function was being called every time, even after after I deleted the record via the jpg a href:
' ####### Determines whether to show Add User Button or Request Space Button based on space left
If num = 2 Then
response.write Session("ResourceID") & " " & (Int( 555555 * Rnd ) + 1)
strSQL1 = "sp_Get_ResourceStatus @ResourceID=" & Session("ResourceID")
Set Query1 = objConnection.Execute(strS QL1)
If Query1("Status") = 1 Then 'Open
ResDetailButtons = 1 'show button
elseif Query1("Status") = 2 Then 'Full
ResDetailButtons = 2 'don't show button
End If
End If
Set Query1 = Nothing
' ####### Determines whether to show Add User Button or Request Space Button based on space left
If num = 2 Then
response.write Session("ResourceID") & " " & (Int( 555555 * Rnd ) + 1)
strSQL1 = "sp_Get_ResourceStatus @ResourceID=" & Session("ResourceID")
Set Query1 = objConnection.Execute(strS
If Query1("Status") = 1 Then 'Open
ResDetailButtons = 1 'show button
elseif Query1("Status") = 2 Then 'Full
ResDetailButtons = 2 'don't show button
End If
End If
Set Query1 = Nothing
ASKER
the rand works every time so I know the function is being called
ASKER
I also tried putting in this delay right before the response redirect in my Expire function:
Dim i
i = 0
Do While i < 2000000
i = i + 1
Loop
the delay didn't do a thing to help
Dim i
i = 0
Do While i < 2000000
i = i + 1
Loop
the delay didn't do a thing to help
ASKER
OK, when I first load the page this is in the URL:
http://sss/sss/main.asp?action=getharddesc&hid=77
when I click on this jpg:
Response.Write("<td width=""5%""><a href=""" & strerdURL & "/main.asp?action=gethardd esc&act=re moveuser&h id=" & Session("ResourceID") & "&eid=" & eID & """><img src=""/erd/images/remove.j pg"" border=""0""></a></td>" & vbCrLf)
It is supposed to as far as I can see, put this into the URL:
main.asp?action=getharddes c&act=remo veuser&hid =77
difference bing it adds the act=removeuser
otherwise if it didn't my Expire function wouldn't fire.
OK, with that, now I assume that happens..that my URL does change to include the act=removeuser. Ok, so when that happens, I have an if statement that checks the querystring, and fires off my Expire Sub as so:
....
elseif act = "removeuser" Then
Call Expire(Request.QueryString ("eid"), 1)
....
Ok, then my Expire sub is fired. At the end of my Expire Sub, it redirects me back to here:
Response.Redirect "/sss/main.asp?action=geth arddesc&hi d=" & Session("ResourceID")
this is essentially sending me back to the original page. I don't see the URL changing to act=removeuser, but maybe that's because it is happening so fast, I can't see it.
With that now, does it matter if I am being redirected back to the same page? What if the act=remover isn't being thrown intothe URL, would that matter in clearing out the state? would that matter either way, if act=remover or not...just by redirecting back to the same page, the redirect should clear state...thus my resourcefull variable right?
http://sss/sss/main.asp?action=getharddesc&hid=77
when I click on this jpg:
Response.Write("<td width=""5%""><a href=""" & strerdURL & "/main.asp?action=gethardd
It is supposed to as far as I can see, put this into the URL:
main.asp?action=getharddes
difference bing it adds the act=removeuser
otherwise if it didn't my Expire function wouldn't fire.
OK, with that, now I assume that happens..that my URL does change to include the act=removeuser. Ok, so when that happens, I have an if statement that checks the querystring, and fires off my Expire Sub as so:
....
elseif act = "removeuser" Then
Call Expire(Request.QueryString
....
Ok, then my Expire sub is fired. At the end of my Expire Sub, it redirects me back to here:
Response.Redirect "/sss/main.asp?action=geth
this is essentially sending me back to the original page. I don't see the URL changing to act=removeuser, but maybe that's because it is happening so fast, I can't see it.
With that now, does it matter if I am being redirected back to the same page? What if the act=remover isn't being thrown intothe URL, would that matter in clearing out the state? would that matter either way, if act=remover or not...just by redirecting back to the same page, the redirect should clear state...thus my resourcefull variable right?
Is there a chance this is down to a delay in your database system?
ASKER
delaying me from moving it to production, that's for sure. This is just one of the quirks I'm trying to fix before we move it and this is like the biggest quirk which really is minor but not the the users....so it is driving me nuts since I want to get this app tested starting Friday but can't until I get this stupid thing resolved.
ASKER
>>>Is there a chance this is down to a delay in your database system?
are you referring to a delay of the deleted record action? if so, no.
are you referring to a delay of the deleted record action? if so, no.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Couple of questions ...
1) What is the original URL.
2) What is the URL that you see in the status bar when you hover over the image.
3) What is the final URL.
4) What is the URL when you refresh and see correct data.
5) Where exactly in main.asp the include file that you have posted is included.
6) I don't see variable act being populated. Do you have more include files that process and assign global variables? If yes, post the structure of your main.asp with include file locations.
Is it possible to see it in action?
1) What is the original URL.
2) What is the URL that you see in the status bar when you hover over the image.
3) What is the final URL.
4) What is the URL when you refresh and see correct data.
5) Where exactly in main.asp the include file that you have posted is included.
6) I don't see variable act being populated. Do you have more include files that process and assign global variables? If yes, post the structure of your main.asp with include file locations.
Is it possible to see it in action?
ASKER
1) What is the original URL
http://sss.com/sss/main.asp
2) What is the URL that you see in the status bar when you hover over the image
http://sss.com/sss/main.asp?action=getharddesc&act=removeuser&hid=77&eid=01725
3) What is the final URL
http://sss.com/sss/main.asp?action=getharddesc&hid=77
4) What is the URL when you refresh and see correct data
http://sss.com/sss/main.asp?action=getharddesc&hid=77
5) Where exactly in main.asp the include file that you have posted is included
At the very end of my main.asp page. If you look at the link below, that is my main.asp. At very bottom it is called hard_desc.asp
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcT4ziUBKsDwygOf&.dir=/EE&.dnm=main.asp&.src=bc
6) I don't see variable act being populated.
- I don't either but my code does populate it otherwise my Expire function wouldn't run at all
Do you have more include files that process and assign global variables?
not any that have the same name...very few in all. I do have some session variables being assigned to a QueryString value here and there also.
http://sss.com/sss/main.asp
2) What is the URL that you see in the status bar when you hover over the image
http://sss.com/sss/main.asp?action=getharddesc&act=removeuser&hid=77&eid=01725
3) What is the final URL
http://sss.com/sss/main.asp?action=getharddesc&hid=77
4) What is the URL when you refresh and see correct data
http://sss.com/sss/main.asp?action=getharddesc&hid=77
5) Where exactly in main.asp the include file that you have posted is included
At the very end of my main.asp page. If you look at the link below, that is my main.asp. At very bottom it is called hard_desc.asp
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcT4ziUBKsDwygOf&.dir=/EE&.dnm=main.asp&.src=bc
6) I don't see variable act being populated.
- I don't either but my code does populate it otherwise my Expire function wouldn't run at all
Do you have more include files that process and assign global variables?
not any that have the same name...very few in all. I do have some session variables being assigned to a QueryString value here and there also.
ASKER
Matthew, I tried this already, is this what you mean...same thing basicaly:
Comment from sajuks feedback
Date: 12/13/2004 09:03PM PST
Comment
try if this will work
adding a random number after a ? or # at the end of the URl should refresh the page
so u shoudl've something like
Response.Redirect url & "?" & (Int( 555555 * Rnd ) + 1)
I tacked on a random number like this but it didn't help in my URL.
Comment from sajuks feedback
Date: 12/13/2004 09:03PM PST
Comment
try if this will work
adding a random number after a ? or # at the end of the URl should refresh the page
so u shoudl've something like
Response.Redirect url & "?" & (Int( 555555 * Rnd ) + 1)
I tacked on a random number like this but it didn't help in my URL.
ASKER
>>>Is it possible to see it in action?
Best I could do is print screen it. But I don't want to give away my creation....let me know if this is required but I hesitate to. It is from our Intranet.
Best I could do is print screen it. But I don't want to give away my creation....let me know if this is required but I hesitate to. It is from our Intranet.
Will you be online for next 30 minutes or so? I want to ask you to put some Response.Write and run the page and post the result back here. Since seeing it in action is not a possibility, this is the only way to troubleshoot it.
ASKER
yes, all night long till I figure this thing out
In main.asp change the code that is outside of any sub to ...
Response.Write("*** Main.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo rm(write) = " & Request.Form("write") & "<br>")
strRowClass = GetRowClassSM(i)
If action = "gethardform" Then
Call ShowUserMain
Call AddResource
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
elseif Request.Form("write") = "1" Then
Call SubmitResource
elseif action="sugg" Then
Call ShowUserMain
Call SubmitSuggestion
elseif action="reports" Then
Response.Redirect("/erd/re ports/repo rt_main.as p")
elseif action="suggreport" Then
Call SuggestionReport
else
Call ShowUserMain
Call ShowLastestAdded
End If
Response.Write("*** Main.asp - End" & "<br>")
Response.Write("*** Main.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo
strRowClass = GetRowClassSM(i)
If action = "gethardform" Then
Call ShowUserMain
Call AddResource
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
elseif Request.Form("write") = "1" Then
Call SubmitResource
elseif action="sugg" Then
Call ShowUserMain
Call SubmitSuggestion
elseif action="reports" Then
Response.Redirect("/erd/re
elseif action="suggreport" Then
Call SuggestionReport
else
Call ShowUserMain
Call ShowLastestAdded
End If
Response.Write("*** Main.asp - End" & "<br>")
In the include file change all the code that is outside of any sub to ...
Response.Write("*** Include File - Start" & "<br>")
Response.Write("act = " & act & "<br>")
If Request.Form("requestrevb" ) = "Approve" Then
Call ApproveRequest
elseif Request.Form("requestrevb" ) = "Deny" Then
Call DenyRequest
End If
If Request.Form("requestmain" ) = "Request Now!" Then
Call SubmitRequest
'Call SendRequest(Session("LastR esourceReq uestID"),S ession("Re sourceID") , Request.Form("purpose"))
elseif Request.Form("stopuse") = "Stop using this Resource" Then
Call Expire(Session("EmployeeID "), 0)
elseif act = "removeuser" Then
Call Expire(Request.QueryString ("eid"), 1)
elseif act = "removesoftware" Then
Call RemoveSoftware(Request.Que ryString(" rsid"))
If loc = "main" Then
Response.Redirect "/erd/main.asp?action=geth arddesc&hi d=" & Session("ResourceID")
elseif loc = "editres" Then
Response.Redirect "/erd/main.asp?action=geth arddesc&ac t=editres& hid=" & Session("ResourceID")
End If
elseif act = "remtempsoft" Then
Call RemoveSoftwareTemp(Request .QueryStri ng("stid") )
elseif Request.Form("adduser") = "Add Now!" Then
Call AddUser
elseif Request.Form("soft_temp") = "1" Then
Call AddTempSoft
elseif Request.Form("write") = "1" Then
Call UpdateResource
End If
Response.Write("*** Include File - End" & "<br>")
Response.Write("*** Include File - Start" & "<br>")
Response.Write("act = " & act & "<br>")
If Request.Form("requestrevb"
Call ApproveRequest
elseif Request.Form("requestrevb"
Call DenyRequest
End If
If Request.Form("requestmain"
Call SubmitRequest
'Call SendRequest(Session("LastR
elseif Request.Form("stopuse") = "Stop using this Resource" Then
Call Expire(Session("EmployeeID
elseif act = "removeuser" Then
Call Expire(Request.QueryString
elseif act = "removesoftware" Then
Call RemoveSoftware(Request.Que
If loc = "main" Then
Response.Redirect "/erd/main.asp?action=geth
elseif loc = "editres" Then
Response.Redirect "/erd/main.asp?action=geth
End If
elseif act = "remtempsoft" Then
Call RemoveSoftwareTemp(Request
elseif Request.Form("adduser") = "Add Now!" Then
Call AddUser
elseif Request.Form("soft_temp") = "1" Then
Call AddTempSoft
elseif Request.Form("write") = "1" Then
Call UpdateResource
End If
Response.Write("*** Include File - End" & "<br>")
Also make a new include file (say DebugCollection.inc) and add the following to it ...
<h3> Session Variable Collection </h3>
<%
On Error Resume Next
For Each Item in Session.Contents
Response.write Item & " = " & Session.Contents(Item) & "<BR>"
For Each ItemKey in Session.Contents(Item)
Response.Write "Sub Item: " & Item & " (" & ItemKey & ") : " _
& Session.Contents(Item)(Ite mKey) & "<br>"
Next
Next
if err.no > 0 Then Display "You must upgrade to IIS 4.0 in order to use the Session Collection<br>"
%>
<h3> QueryString Collection </h3>
<%
For Each Item in Request.QueryString
For iCount = 1 to Request.QueryString(Item). Count
Response.Write Item & " = " & Request.QueryString(Item)( iCount) & "<br>"
Next
Next
%>
<h3> Form Collection </h3>
<%
For Each Item in Request.Form
For iCount = 1 to Request.Form(Item).Count
Response.Write Item & " = " & Request.Form(Item)(iCount) & "<br>"
Next
Next
%>
Include this file in Main.asp at the top.
<h3> Session Variable Collection </h3>
<%
On Error Resume Next
For Each Item in Session.Contents
Response.write Item & " = " & Session.Contents(Item) & "<BR>"
For Each ItemKey in Session.Contents(Item)
Response.Write "Sub Item: " & Item & " (" & ItemKey & ") : " _
& Session.Contents(Item)(Ite
Next
Next
if err.no > 0 Then Display "You must upgrade to IIS 4.0 in order to use the Session Collection<br>"
%>
<h3> QueryString Collection </h3>
<%
For Each Item in Request.QueryString
For iCount = 1 to Request.QueryString(Item).
Response.Write Item & " = " & Request.QueryString(Item)(
Next
Next
%>
<h3> Form Collection </h3>
<%
For Each Item in Request.Form
For iCount = 1 to Request.Form(Item).Count
Response.Write Item & " = " & Request.Form(Item)(iCount)
Next
Next
%>
Include this file in Main.asp at the top.
In
Sub Expire(EmployeeID, whoexpired)
Change
Response.Redirect "/erd/main.asp?act=expired &reload&ac tion=getha rddesc&hid =" & Session("ResourceID")
to
Response.Write "Redirecting to ..." & "<br>"
Response.Write "/erd/main.asp?act=expired &reload&ac tion=getha rddesc&hid =" & Session("ResourceID") & "<br>"
'Response.Redirect "/erd/main.asp?act=expired &reload&ac tion=getha rddesc&hid =" & Session("ResourceID")
We don't want to redirect. Just print the URL to redirect.
Sub Expire(EmployeeID, whoexpired)
Change
Response.Redirect "/erd/main.asp?act=expired
to
Response.Write "Redirecting to ..." & "<br>"
Response.Write "/erd/main.asp?act=expired
'Response.Redirect "/erd/main.asp?act=expired
We don't want to redirect. Just print the URL to redirect.
ASKER
Ok, this is what I see:
1) When I go to page http://sss.com/sss/main.asp
I see:
*** Main.asp - Start
action =
Request.Form(write) =
2) When I click on a Resouce Name from main.asp, it refreshes then shows me the description after this is evaluated:
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
it shows this after the refresh in #2:
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
3) Now when I am able to see the hardware description (in the hard_desc.inc), I then click on the jpg to remove a user in this section:
'####### Show Who is using this resource
When I click on the jpg (<a href=""" & strerdURL & "/main.asp?action=gethardd esc&act=re moveuser&h id=" & Session("ResourceID") & "&eid=" & eID & """><img src=""/erd/images/remove.j pg"" border=""0""></a), the form deletes the record (by invoking the Expire sub), and the page refreshes again and shows this:
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
4) At this point, the problem still remains, the resourcefull variable has not been cleared, it is still holding state. Eveyrthing else though is up-to-date such as the listing of resources from main.asp, the listing of who is using the resource in hard_desc.inc, etc.
5) I click refresh, now the resourcefull is correct and shows that it is or isn't full and is accurate now based off that record I just deleted. The page shows:
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
1) When I go to page http://sss.com/sss/main.asp
I see:
*** Main.asp - Start
action =
Request.Form(write) =
2) When I click on a Resouce Name from main.asp, it refreshes then shows me the description after this is evaluated:
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
it shows this after the refresh in #2:
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
3) Now when I am able to see the hardware description (in the hard_desc.inc), I then click on the jpg to remove a user in this section:
'####### Show Who is using this resource
When I click on the jpg (<a href=""" & strerdURL & "/main.asp?action=gethardd
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
4) At this point, the problem still remains, the resourcefull variable has not been cleared, it is still holding state. Eveyrthing else though is up-to-date such as the listing of resources from main.asp, the listing of who is using the resource in hard_desc.inc, etc.
5) I click refresh, now the resourcefull is correct and shows that it is or isn't full and is accurate now based off that record I just deleted. The page shows:
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
Make all these changes. Clear the cache of your browser and run the page. Click on the jpeg and in each reauest, post whatever debug information is printed on the screen.
ASKER
Ok, let me try your last requested changes also and I'll post in a sec
Why don't we see output of
Response.Write("*** Main.asp - End" & "<br>")
Make sure to put the Response.Write with "End" in both Main.asp and the include file.
Also clear your browser cache before running the test.
Response.Write("*** Main.asp - End" & "<br>")
Make sure to put the Response.Write with "End" in both Main.asp and the include file.
Also clear your browser cache before running the test.
ASKER
Ok, I don't get anything printed to the screen at any time ( during initial run of the app, or when I remove the user by clicking on the jpg) but I do see this after I click on the jpg:
Redirecting to ...
/sss/main.asp?act=expired& reload&act ion=gethar ddesc&hid= 77
Then If I refresh again, I still get this:
*** Main.asp - End
Redirecting to ...
/sss/main.asp?act=expired& reload&act ion=gethar ddesc&hid= 77
Redirecting to ...
/sss/main.asp?act=expired&
Then If I refresh again, I still get this:
*** Main.asp - End
Redirecting to ...
/sss/main.asp?act=expired&
ASKER
I meant I didn't get any of the info in the debut.asp include in my first sentence at any time.
Did you make all the changes ...
1) Add few Reposne.Write in Main.asp - I see the partial output but I need to see the complete output in the exact order it appears in screen.
2) Add few Reposne.Write in the include file - I don't see any output from these statements.
3) Add a new include file and include that in Main.asp - I don't see any output from these statements also.
4) Change Response.Redirect to Response.Write in ExpireSub - I see this output.
1) Add few Reposne.Write in Main.asp - I see the partial output but I need to see the complete output in the exact order it appears in screen.
2) Add few Reposne.Write in the include file - I don't see any output from these statements.
3) Add a new include file and include that in Main.asp - I don't see any output from these statements also.
4) Change Response.Redirect to Response.Write in ExpireSub - I see this output.
ASKER
Ok, this is what I did so far:
1) my main.asp now has this at the top:
Response.Write("*** Main.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo rm(write) = " & Request.Form("write") & "<br>")
strRowClass = GetRowClassSM(i)
If action = "gethardform" Then
Call ShowUserMain
Call AddResource
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
elseif Request.Form("write") = "1" Then
Call SubmitResource
elseif action="sugg" Then
Call ShowUserMain
Call SubmitSuggestion
elseif action="reports" Then
Response.Redirect("/erd/re ports/repo rt_main.as p")
elseif action="suggreport" Then
Call SuggestionReport
else
Call ShowUserMain
Call ShowLastestAdded
End If
Response.Write("*** Main.asp - End" & "<br>")
2) I put the include file here in my main.asp for the debug:
<!--#include virtual="/erd/debug.asp" -->
<%
Response.Write("<h3>Welcom e, " & Session("UserName") & "</h3>" & vbCrLf)
Dim bolHasApprovals, bolHasAssigned, bolOpenContent, bolClosedContent, arrCSS, ResourceID, requested
Response.Write("*** Main.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo rm(write) = " & Request.Form("write") & "<br>")
strRowClass = GetRowClassSM(i)
If action = "gethardform" Then
Call ShowUserMain
Call AddResource
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
elseif Request.Form("write") = "1" Then
Call SubmitResource
elseif action="sugg" Then
.......
3) I put the response.redirect like you wanted in the Expire function
I am unclear on your last #2 on what you want me to do. Do you want me to put this at the top of each include file?
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo rm(write) = " & Request.Form("write") & "<br>")
1) my main.asp now has this at the top:
Response.Write("*** Main.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo
strRowClass = GetRowClassSM(i)
If action = "gethardform" Then
Call ShowUserMain
Call AddResource
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
elseif Request.Form("write") = "1" Then
Call SubmitResource
elseif action="sugg" Then
Call ShowUserMain
Call SubmitSuggestion
elseif action="reports" Then
Response.Redirect("/erd/re
elseif action="suggreport" Then
Call SuggestionReport
else
Call ShowUserMain
Call ShowLastestAdded
End If
Response.Write("*** Main.asp - End" & "<br>")
2) I put the include file here in my main.asp for the debug:
<!--#include virtual="/erd/debug.asp" -->
<%
Response.Write("<h3>Welcom
Dim bolHasApprovals, bolHasAssigned, bolOpenContent, bolClosedContent, arrCSS, ResourceID, requested
Response.Write("*** Main.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo
strRowClass = GetRowClassSM(i)
If action = "gethardform" Then
Call ShowUserMain
Call AddResource
elseif action="getharddesc" Then
Call ShowResourceDesc
Call ShowUserMain
Call ShowLastestAdded
elseif Request.Form("write") = "1" Then
Call SubmitResource
elseif action="sugg" Then
.......
3) I put the response.redirect like you wanted in the Expire function
I am unclear on your last #2 on what you want me to do. Do you want me to put this at the top of each include file?
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo
ASKER
fyi - erd I have been changing to sss for privacy concerns so <!--#include virtual="/erd/debug.asp" --> is the same thing
ASKER
I do see the following rows at the top of my page but just no values below each row:
Session Variable Collection
no values show up
QueryString Collection
no values show
Form Collection
no values show
Session Variable Collection
no values show up
QueryString Collection
no values show
Form Collection
no values show
Not all include files but the one you have posted. I think it would be hard_desc.asp. Basically the one that has Sub Expire(EmployeeID, whoexpired).
ASKER
yea, it's hard_desc.asp. Ok, I'll put those 2 lines at the top
All seems to be fine so far. Add the debug lines to the include file in question and run the code again. Post the result of all the debug statements in each step. Also post the URL at each step.
Make sure to add line with "End" in it also. It will explain the flow and relative positioning.
ASKER
at the very top of my hard_desc.asp it is now:
Response.Write("*** hard_desc.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo rm(write) = " & Request.Form("write") & "<br>")
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
If Request.Form("requestrevb" ) = "Approve" Then
Call ApproveRequest
elseif Request.Form("requestrevb" ) = "Deny" Then
Call DenyRequest
elseif Request.Form("requestrevb" ) = "Extend Use!" Then
Call ExtendUse
End If
If Request.Form("requestmain" ) = "Request Now!" Then
Call SubmitRequest
'Call SendRequest(Session("LastR esourceReq uestID"),S ession("Re sourceID") , Request.Form("purpose"))
elseif Request.Form("stopuse") = "Stop using this Resource" Then
Call Expire(Session("EmployeeID "), 0)
elseif act = "removeuser" Then
Call Expire(Request.QueryString ("eid"), 1)
elseif act = "removesoftware" Then
Call RemoveSoftware(Request.Que ryString(" rsid"))
If loc = "main" Then
Response.Redirect "/sss/main.asp?action=geth arddesc&hi d=" & Session("ResourceID")
elseif loc = "editres" Then
Response.Redirect "/sss/main.asp?action=geth arddesc&ac t=editres& hid=" & Session("ResourceID")
End If
elseif act = "remtempsoft" Then
Call RemoveSoftwareTemp(Request .QueryStri ng("stid") )
elseif Request.Form("adduser") = "Add Now!" Then
Call AddUser
elseif Request.Form("soft_temp") = "1" Then
Call AddTempSoft
elseif Request.Form("write") = "1" Then
Call UpdateResource
End If
......and so on
The output is this and shows up at the very bottom of my page when I click on a resource from main.asp after it invokes Sub ShowResourceDesc to run:
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
Response.Write("*** hard_desc.asp - Start" & "<br>")
Response.Write("action = " & action & "<br>")
Response.Write("Request.Fo
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
If Request.Form("requestrevb"
Call ApproveRequest
elseif Request.Form("requestrevb"
Call DenyRequest
elseif Request.Form("requestrevb"
Call ExtendUse
End If
If Request.Form("requestmain"
Call SubmitRequest
'Call SendRequest(Session("LastR
elseif Request.Form("stopuse") = "Stop using this Resource" Then
Call Expire(Session("EmployeeID
elseif act = "removeuser" Then
Call Expire(Request.QueryString
elseif act = "removesoftware" Then
Call RemoveSoftware(Request.Que
If loc = "main" Then
Response.Redirect "/sss/main.asp?action=geth
elseif loc = "editres" Then
Response.Redirect "/sss/main.asp?action=geth
End If
elseif act = "remtempsoft" Then
Call RemoveSoftwareTemp(Request
elseif Request.Form("adduser") = "Add Now!" Then
Call AddUser
elseif Request.Form("soft_temp") = "1" Then
Call AddTempSoft
elseif Request.Form("write") = "1" Then
Call UpdateResource
End If
......and so on
The output is this and shows up at the very bottom of my page when I click on a resource from main.asp after it invokes Sub ShowResourceDesc to run:
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
ASKER
let me know if I'm not doing what you need here...sorry if I have misunderstood anything.
ASKER
Let me repost my 2 files now with the additions so you can at least see all my code:
main.asp
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcn4QjUBF1pcGU5t&.dir=/EE&.dnm=main---1.asp&.src=bc
hard_desc.asp (include)
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcn4QjUB5STkIiEz&.dir=/EE&.dnm=hard_desc.asp&.src=bc
main.asp
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcn4QjUBF1pcGU5t&.dir=/EE&.dnm=main---1.asp&.src=bc
hard_desc.asp (include)
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcn4QjUB5STkIiEz&.dir=/EE&.dnm=hard_desc.asp&.src=bc
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will be offline for an hour or so. Add more Response.Writes and follow the flow of program. Add Response.Writes in all functions/subs where you see the problem. Also keep checking the URL for Query String changes. Comment any Response.Redirect and print URL instead. Then copy and paste that URL to the location bar manually and see if you see the correct output. Post the experience and hopefully you would have found the problem by then :)
ASKER
Ok, did all that you requested. I did have one On Error Resume Next which I commented out in my functions include.
When I put this in my main.asp at the very top, I get an error in my functions include and the page doesn't render
<%
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
%>
<!--#include virtual="/sss/includes/fun ctions.asp " -->
<% strPageTitle = " | Home" %>
<!--#include virtual="/sss/includes/hea der.asp" -->
<!--#include virtual="/sss/debug.asp" -->
<%
is it ok if I put it after the functions include?
When I put this in my main.asp at the very top, I get an error in my functions include and the page doesn't render
<%
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
%>
<!--#include virtual="/sss/includes/fun
<% strPageTitle = " | Home" %>
<!--#include virtual="/sss/includes/hea
<!--#include virtual="/sss/debug.asp" -->
<%
is it ok if I put it after the functions include?
ASKER
np..thanks very much
What error?
ASKER
I get this error if I pasted that in the beginning of main.asp
Expected statement
/sss/sss/functions.asp, line 2
The only thing that is in line 2 of my functions is this:
Option Explicit
Expected statement
/sss/sss/functions.asp, line 2
The only thing that is in line 2 of my functions is this:
Option Explicit
ASKER
ok, took out option explicit, here we go.
Don't take off Option Explicit. Put these statements after Option Explicit.
ASKER
ok, then that means I'll have to put those statements right aftet my functions include...that's where the option explicit was
ASKER
The functions include holds the Sub that is called for resourcefull variable in hard_desc.asp...just and fyi
Yes, as long as there is no Response.Write called in the functions include outside of sub/functions.
ASKER
and holds a bunch of other functions also obviously.
ASKER
Ok, that clears everything. I put it like this:
<!--#include virtual="/sss/includes/fun ctions.asp " -->
<%
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
%>
<% strPageTitle = " | Home" %>
<!--#include virtual="/sss/includes/hea der.asp" -->
<h1>Engineering Resource Dashboard</h1>
<!--#include virtual="/sss/debug.asp" -->
<%
...main.asp code
So now nothing shows in the debug whereas it did if I took out the option explicit....do you want to see the results from it when I took option explicit out or not?
<!--#include virtual="/sss/includes/fun
<%
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
%>
<% strPageTitle = " | Home" %>
<!--#include virtual="/sss/includes/hea
<h1>Engineering Resource Dashboard</h1>
<!--#include virtual="/sss/debug.asp" -->
<%
...main.asp code
So now nothing shows in the debug whereas it did if I took out the option explicit....do you want to see the results from it when I took option explicit out or not?
ASKER
Here are results I get when I took out option explicit
1) I closed out my browser, deleted cache
2) I log into main.asp. URL is
http://sss/sss/main.asp
Info posted to page is (I renamed stuff to sss and dba321 but they have valid values):
Session Variable Collection
EmployeeID = 01800
UserName = dba321
SiteAdmin = True
Reporting = True
QueryString Collection
Form Collection
Cookies Collection
--- sss = LN=dba321
Sub Item: sss(LN) = dba321
Welcome, dba321
*** Main.asp - Start
action =
Request.Form(write) =
....records rendered to page
*** Main.asp - End
*** hard_desc.asp - Start
action =
Request.Form(write) =
3) I now click on a Resource link in my main.asp. The page refreshes and I am taken to the details
of this resouce. The URL is now
http://sss/sss/main.asp?action=getharddesc&hid=77
Info posted to the page is:
resourcefull: 2 (I also printed this out)
Session Variable Collection
EmployeeID = 01800
UserName = dba321
SiteAdmin = True
Reporting = True
QueryString Collection
action = getharddesc
hid = 77
Form Collection
Cookies Collection
--- sss = LN=dba321
Sub Item: sss(LN) = dba321
Welcome, dba321
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
....records rendered to page as well as the hard_desc details
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
4) Now I click on the jpg next to the users name (found in hard_desc.asp, section '####### Show Who is using this resource)
The page refreshes, the user is gone. Now it should no longer say "Resource is Full" but it does since
resourcefull still = 2 but I know for a fact that if I refresh right now..it will change to 1 and truely reflect the right
value because it is based on that user record I just deleted
The URL is now:
http://sss/sss/main.asp?action=getharddesc&act=removeuser&hid=77&eid=01866
Info posted to the page is:
resourcefull: 2
Session Variable Collection
EmployeeID = 01800
UserName = dba123
SiteAdmin = True
Reporting = True
ResourceID = 77
QueryString Collection
action = getharddesc
act = removeuser
hid = 77
eid = 01866
Form Collection
Cookies Collection
--- sss = LN=dba123
Sub Item: sss(LN) = dba123
Welcome, dba123
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
....records rendered to page as well as the hard_desc details
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
Redirecting to ...
/erd/main.asp?act=expired& reload&act ion=gethar ddesc&hid= 77
5) I refresh again. Now the resourcefull variable is showing a correct value of 1. The text "Resource is Full" disappears.
The URL is now:
http://sss/sss/main.asp?action=getharddesc&act=removeuser&hid=77&eid=01866
Info posted to the page is:
resourcefull: 1 (now it changed!!)
Engineering Resource Dashboard
Session Variable Collection
EmployeeID = 01800
UserName = dba123
SiteAdmin = True
Reporting = True
ResourceID = 77
QueryString Collection
action = getharddesc
act = removeuser
hid = 77
eid = 01866
Form Collection
Cookies Collection
--- sss = LN=dba123
Sub Item: sss(LN) = dba123
Welcome, dba123
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
....records rendered to page as well as the hard_desc details
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
Redirecting to ...
/sss/main.asp?act=expired& reload&act ion=gethar ddesc&hid= 77
1) I closed out my browser, deleted cache
2) I log into main.asp. URL is
http://sss/sss/main.asp
Info posted to page is (I renamed stuff to sss and dba321 but they have valid values):
Session Variable Collection
EmployeeID = 01800
UserName = dba321
SiteAdmin = True
Reporting = True
QueryString Collection
Form Collection
Cookies Collection
--- sss = LN=dba321
Sub Item: sss(LN) = dba321
Welcome, dba321
*** Main.asp - Start
action =
Request.Form(write) =
....records rendered to page
*** Main.asp - End
*** hard_desc.asp - Start
action =
Request.Form(write) =
3) I now click on a Resource link in my main.asp. The page refreshes and I am taken to the details
of this resouce. The URL is now
http://sss/sss/main.asp?action=getharddesc&hid=77
Info posted to the page is:
resourcefull: 2 (I also printed this out)
Session Variable Collection
EmployeeID = 01800
UserName = dba321
SiteAdmin = True
Reporting = True
QueryString Collection
action = getharddesc
hid = 77
Form Collection
Cookies Collection
--- sss = LN=dba321
Sub Item: sss(LN) = dba321
Welcome, dba321
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
....records rendered to page as well as the hard_desc details
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
4) Now I click on the jpg next to the users name (found in hard_desc.asp, section '####### Show Who is using this resource)
The page refreshes, the user is gone. Now it should no longer say "Resource is Full" but it does since
resourcefull still = 2 but I know for a fact that if I refresh right now..it will change to 1 and truely reflect the right
value because it is based on that user record I just deleted
The URL is now:
http://sss/sss/main.asp?action=getharddesc&act=removeuser&hid=77&eid=01866
Info posted to the page is:
resourcefull: 2
Session Variable Collection
EmployeeID = 01800
UserName = dba123
SiteAdmin = True
Reporting = True
ResourceID = 77
QueryString Collection
action = getharddesc
act = removeuser
hid = 77
eid = 01866
Form Collection
Cookies Collection
--- sss = LN=dba123
Sub Item: sss(LN) = dba123
Welcome, dba123
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
....records rendered to page as well as the hard_desc details
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
Redirecting to ...
/erd/main.asp?act=expired&
5) I refresh again. Now the resourcefull variable is showing a correct value of 1. The text "Resource is Full" disappears.
The URL is now:
http://sss/sss/main.asp?action=getharddesc&act=removeuser&hid=77&eid=01866
Info posted to the page is:
resourcefull: 1 (now it changed!!)
Engineering Resource Dashboard
Session Variable Collection
EmployeeID = 01800
UserName = dba123
SiteAdmin = True
Reporting = True
ResourceID = 77
QueryString Collection
action = getharddesc
act = removeuser
hid = 77
eid = 01866
Form Collection
Cookies Collection
--- sss = LN=dba123
Sub Item: sss(LN) = dba123
Welcome, dba123
*** Main.asp - Start
action = getharddesc
Request.Form(write) =
....records rendered to page as well as the hard_desc details
*** Main.asp - End
*** hard_desc.asp - Start
action = getharddesc
Request.Form(write) =
Redirecting to ...
/sss/main.asp?act=expired&
Option Explicit should not make any difference unless there is undeclared variables used. It is always good idea to have this in the code. Having it eliminates some very silly bugs. Also it should be the very first line in the asp page. So take it out of functions include and put it as very first line in main.asp. Run the code again and confirm that you don't get any error. You should also see the same result that you have posted.
resourcefull variable depends upon Session("EmployeeID") and Session("ResourceID") as per ...
resourcefull = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 2)
when the user is expiered what changes in these 2 session variables and where?
resourcefull variable depends upon Session("EmployeeID") and Session("ResourceID") as per ...
resourcefull = ResDetailButtons(Session("
when the user is expiered what changes in these 2 session variables and where?
ASKER
ok, I think I need to post a pick here...I'll just remove it later on
Here is when you first render main.asp (before it calls the sub in my hard_desc.asp to show the details)
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcXjUjUBP5Vw999h&.dir=/EE&.dnm=app_.gif&.src=bc
Here is a shot right after I click on a resouce link and where the problem lies
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcarUjUBY_Fdo3q_&.dir=/EE&.dnm=app.gif&.src=bc
Here is when you first render main.asp (before it calls the sub in my hard_desc.asp to show the details)
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcXjUjUBP5Vw999h&.dir=/EE&.dnm=app_.gif&.src=bc
Here is a shot right after I click on a resouce link and where the problem lies
http://f2.pg.briefcase.yahoo.com/bc/dba332211/vwp2?.tok=bcarUjUBY_Fdo3q_&.dir=/EE&.dnm=app.gif&.src=bc
ASKER
Session("EmployeeID") - doesn't change, that is my employeeid grabbed at login
Session("ResourceID") is set like this somewhere in my code:
Session("ResourceID") = Request.QueryString("hid")
Don't ask me why I'm using a session to grab a querystring, I just kept doing it and was lazy to just creeate a variable since I was learning about sessions at first.
Session("ResourceID") is set like this somewhere in my code:
Session("ResourceID") = Request.QueryString("hid")
Don't ask me why I'm using a session to grab a querystring, I just kept doing it and was lazy to just creeate a variable since I was learning about sessions at first.
So basically both these are static ... at least for the session. So how does resourcefull changes after the expire?
ASKER
amit....I appreciate all you've done tonight. I'm going to bed now before I go insane. Can we pick this up tomorrow morning?
Sure. See you tomorrow.
ASKER
When I delete a user this happens:
1) User record is deleted
2) I have a function that determines if the resource is still full based on the amount of disk space checked out by users of that resource vs. the total disk space - 30
3) If the resource is no longer full after I delete a user a function changes the status to 1 in the resource record (hid)
4) Now this is where the resourcefull comes in. Every refresh of the page what it is supposed todo is simply queries the resource table, looks for that ID and checks its status. If it is full, then resourcefull = 2, if not then resourcefull = 1.
but the function that resourcefull is set to seems not to recaculate (run through again) until I click refresh on my browser instead
1) User record is deleted
2) I have a function that determines if the resource is still full based on the amount of disk space checked out by users of that resource vs. the total disk space - 30
3) If the resource is no longer full after I delete a user a function changes the status to 1 in the resource record (hid)
4) Now this is where the resourcefull comes in. Every refresh of the page what it is supposed todo is simply queries the resource table, looks for that ID and checks its status. If it is full, then resourcefull = 2, if not then resourcefull = 1.
but the function that resourcefull is set to seems not to recaculate (run through again) until I click refresh on my browser instead
ASKER
I posted the function that resourcefull is = to in a previous post with a URL to it...just look for it above.
ASKER
I know that function works fine cause when I refresh, it brings back the right value based on the status of that resource....completely agrees with the resource record in the backend.
ASKER
till tomorrow...
When you get to it tomorrow ...
1) Put back Option Explicit as the first line in Main.asp and remove it from functions include. Run the code again and make sure there is no error. If you get the error, fix it. You might have to Dim some missing variables.
2) Make sure there is no "On Error Resume Next". There is one in debug.asp, you can ignore that one. Except that your all files should not contain this line. Remove all such lines if you find any. Also make sure that debug.asp has the last posted code. Look for a line On Error GoTo 0. This is the line that I added in the second post. If you have it, you have correct code.
3) In Sub Expire(EmployeeID, whoexpired) just before the Response.Write (the one we added replacing the Response.Redirect) add following code...
Dim resourcefull_Test
resourcefull_Test = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 2)
Response.Write ("resourcefull_Test = " & resourcefull_Test)
Now repeat all 4 steps and check the debug output. What is the value of resourcefull_Test? It should be 1 as the database has already been updated and this value comes from database.
4) Going back to the 5 steps you have written ... In step 4 you get a URL printed on the screen
Redirecting to ...
/erd/main.asp?act=expired& reload&act ion=gethar ddesc&hid= 77
Do not refresh at this point. Copy the URL and paste it in the location bar. What debug output do you see on the screen now. Check the URL in the location bar also. Does it change?
5) Various functions get called during the refresh. Does any of them update the database? I am asking only when the refresh takes place and not when Expires function/sub is called.
1) Put back Option Explicit as the first line in Main.asp and remove it from functions include. Run the code again and make sure there is no error. If you get the error, fix it. You might have to Dim some missing variables.
2) Make sure there is no "On Error Resume Next". There is one in debug.asp, you can ignore that one. Except that your all files should not contain this line. Remove all such lines if you find any. Also make sure that debug.asp has the last posted code. Look for a line On Error GoTo 0. This is the line that I added in the second post. If you have it, you have correct code.
3) In Sub Expire(EmployeeID, whoexpired) just before the Response.Write (the one we added replacing the Response.Redirect) add following code...
Dim resourcefull_Test
resourcefull_Test = ResDetailButtons(Session("
Response.Write ("resourcefull_Test = " & resourcefull_Test)
Now repeat all 4 steps and check the debug output. What is the value of resourcefull_Test? It should be 1 as the database has already been updated and this value comes from database.
4) Going back to the 5 steps you have written ... In step 4 you get a URL printed on the screen
Redirecting to ...
/erd/main.asp?act=expired&
Do not refresh at this point. Copy the URL and paste it in the location bar. What debug output do you see on the screen now. Check the URL in the location bar also. Does it change?
5) Various functions get called during the refresh. Does any of them update the database? I am asking only when the refresh takes place and not when Expires function/sub is called.
ASKER
1) Put back Option Explicit as the first line in Main.asp
No problems....works fine
2) Make sure there is no "On Error Resume Next". There is one in debug.asp, you can ignore that one. Except that your all files should not contain this line. Remove all such lines if you find any. Also make sure that debug.asp has the last posted code
I do not have any On Error Resume Next in my files. Yes, for sure, I have your latest debug code in my debug include.
3) replaced code in the Expire Sub
now I get no varibles showing on any of the pages in your debug again.
No problems....works fine
2) Make sure there is no "On Error Resume Next". There is one in debug.asp, you can ignore that one. Except that your all files should not contain this line. Remove all such lines if you find any. Also make sure that debug.asp has the last posted code
I do not have any On Error Resume Next in my files. Yes, for sure, I have your latest debug code in my debug include.
3) replaced code in the Expire Sub
now I get no varibles showing on any of the pages in your debug again.
ASKER
so this is at the top of main.asp now:
<%Option Explicit%>
<!--#include virtual="/sss/includes/fun ctions.asp " -->
<%
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
%>
<% strPageTitle = " | Home" %>
<!--#include virtual="/sss/includes/hea der.asp" -->
<h1>sss</h1>
<!--#include virtual="/sss/debug.asp" -->
<%
<%Option Explicit%>
<!--#include virtual="/sss/includes/fun
<%
Response.Buffer=true
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
response.expires = 0
%>
<% strPageTitle = " | Home" %>
<!--#include virtual="/sss/includes/hea
<h1>sss</h1>
<!--#include virtual="/sss/debug.asp" -->
<%
ASKER
also, now I have to refresh twice, I noticed that last night before I even tried your suggestions this morning. I have to refresh 2 times now in order for resourcefull to ring home it's true value reflected by the status of the Resouce's Record (status field).
ASKER
I also tried just taking what was in the Res function and commenting out the variables and trying this in my hard_desc.asp but it didn't help. I thought to just check by putting the code straight into the main flow of my app since maybe the function wasn't being called right away for resourcefull but that doesn't seem to be the case I guess.
Dim hidebutton, hidebutton2, resourcefull
hidebutton = 0
hidebutton2 = 0
resourcefull = 0
'response.write "resourcefull try 1 : " & resourcefull & "<br>"
'hidebutton = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 1)
'resourcefull = ResDetailButtons(Session(" EmployeeID "), Session("ResourceID"), 2)
'response.write "resourcefull try 2 : " & resourcefull
Dim bolhidebutton_r
strSQL1 = "sp_Get_Resources_IUse @CheckedOutByID=" & Session("EmployeeID")
Set Query1 = objConnection.Execute(strS QL1)
Do While NOT Query1.EOF
If Trim(Query1("ResourceID")) = Trim(ResourceID) Then
bolhidebutton_r = 1
exit do '### exit when match found to prevent bol to go back to 0 on next loop
else
bolhidebutton_r = 0
End If
Query1.MoveNext
Loop
If bolhidebutton_r = 0 Then
hidebutton = 0
else
hidebutton = 1
End If
Dim ResDetailButtons
strSQL1 = "sp_Get_ResourceStatus @ResourceID=" & Session("ResourceID")
Set Query1 = objConnection.Execute(strS QL1)
If Query1("Status") = 1 Then 'Open
ResDetailButtons = 1 'show button
elseif Query1("Status") = 2 Then 'Full
ResDetailButtons = 2 'don't show button
End If
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"">" & vbCrLf)
Response.Write(" <form action=""/erd/main.asp?act ion=gethar ddesc&hid= " & Session("ResourceID") & """ method=""post"" name=""request"">" & vbCrLf)
Response.Write(" <input type=""hidden"" name=""write"" value=""request"">" & vbCrLf)
requested = 0
requested = CheckRequested(Session("Em ployeeID") , Session("ResourceID"))
If hidebutton = 0 AND ResDetailButtons <> 2 AND requested <> 1 Then
Response.Write(" <br><input type=""submit"" name=""requestspace"" value=""Request To Use This Resource"" class=""submitbutton""><br ><br>" & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
If ResDetailButtons = 2 Then
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td align=""center"" valign=""top"" class=""full"">This resource is currently FULL</td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"" class=""full_sm"">*There is a 30 gig safety net for any <br>resource with total disk space > 50 gigs<br>*There is a 10 gig safety for any <br>resource with total disk space of < 50 gigs" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
End If
Dim hidebutton, hidebutton2, resourcefull
hidebutton = 0
hidebutton2 = 0
resourcefull = 0
'response.write "resourcefull try 1 : " & resourcefull & "<br>"
'hidebutton = ResDetailButtons(Session("
'resourcefull = ResDetailButtons(Session("
'response.write "resourcefull try 2 : " & resourcefull
Dim bolhidebutton_r
strSQL1 = "sp_Get_Resources_IUse @CheckedOutByID=" & Session("EmployeeID")
Set Query1 = objConnection.Execute(strS
Do While NOT Query1.EOF
If Trim(Query1("ResourceID"))
bolhidebutton_r = 1
exit do '### exit when match found to prevent bol to go back to 0 on next loop
else
bolhidebutton_r = 0
End If
Query1.MoveNext
Loop
If bolhidebutton_r = 0 Then
hidebutton = 0
else
hidebutton = 1
End If
Dim ResDetailButtons
strSQL1 = "sp_Get_ResourceStatus @ResourceID=" & Session("ResourceID")
Set Query1 = objConnection.Execute(strS
If Query1("Status") = 1 Then 'Open
ResDetailButtons = 1 'show button
elseif Query1("Status") = 2 Then 'Full
ResDetailButtons = 2 'don't show button
End If
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"">" & vbCrLf)
Response.Write(" <form action=""/erd/main.asp?act
Response.Write(" <input type=""hidden"" name=""write"" value=""request"">" & vbCrLf)
requested = 0
requested = CheckRequested(Session("Em
If hidebutton = 0 AND ResDetailButtons <> 2 AND requested <> 1 Then
Response.Write(" <br><input type=""submit"" name=""requestspace"" value=""Request To Use This Resource"" class=""submitbutton""><br
End If
Response.Write(" </td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
If ResDetailButtons = 2 Then
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td align=""center"" valign=""top"" class=""full"">This resource is currently FULL</td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td align=""left"" valign=""top"" class=""full_sm"">*There is a 30 gig safety net for any <br>resource with total disk space > 50 gigs<br>*There is a 10 gig safety for any <br>resource with total disk space of < 50 gigs" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
End If
ASKER
I found that the reason I have to refresh 2 times how is due to one of the following
Moving Option Explicit
or
having the Debug code included
or more likely
commenting out the response.redirect in the Expire function.
Moving Option Explicit
or
having the Debug code included
or more likely
commenting out the response.redirect in the Expire function.
ASKER
Ok, I don't know why I didnt' try this before.
In my Expire Function, I changed the response.redirect to include after getharddesc
Response.Redirect "/sss/main.asp?act=expired &action=ge tharddesc2 &hid=" & Session("ResourceID")
After I clicked the jpg to remove the user, I watched the URL...it never got here. It still had this in the URL after the page refreshed after clicking to remove the user:
http://sss/sss/main.asp?act=expired&action=getharddesc2&hid=78
so my response.redirect isn't working it looks like.
In my Expire Function, I changed the response.redirect to include after getharddesc
Response.Redirect "/sss/main.asp?act=expired
After I clicked the jpg to remove the user, I watched the URL...it never got here. It still had this in the URL after the page refreshed after clicking to remove the user:
http://sss/sss/main.asp?act=expired&action=getharddesc2&hid=78
so my response.redirect isn't working it looks like.
ASKER
oh, nevermind my last post...no, it did work..I wasn't reading. The redirect did work.
ASKER
Well beleive it or not, I have a resolution. I didn't think this was a problem but....It was when the status of the resource was populated. It was being populated after the ResDetail function was being called. I though that my logic wasn't doing it this way but I guess it is...still don't see how but it is.
So I had to make status = 1 in the actual AddUser Sub
And for the Expire Sub, i had to make the status = 1 right after I removed the user.
Prior, I was doing this in the StatusColor function call in my main.asp. Since the little red dots were updating from my main, I figured that this happened before the hard_desc was rendering but it wasn't.
So in other words, my StatusColor is the one that I had changing the status to 1 or 2 and also wrote the jpg color to the screen. That status update was happening after resourcename variable was calling the ResDetail function. I thought this wasn't so but it is.
So I created a function to call at the end of both the Sub AddUser and the Sub Expire, right after the AddUser function adds the user, or rigth after the Expire deletes the user like this:
Sub Expire(EmployeeID, whoexpired)
strSQL = "sp_DoExpireResourceUsage "
strSQL = strSQL & " @ResourceID = '" & Session("ResourceID") & "',"
strSQL = strSQL & " @WhoStoppedUse = '" & Cint(whoexpired) & "',"
strSQL = strSQL & " @CheckedOutByID = '" & EmployeeID & "',"
strSQL = strSQL & " @AdminID = '" & Session("EmployeeID") & "',"
strSQL = strSQL & " @RemovedDate = '" & Now() & "'"
Set Query = objConnection.Execute(strS QL)
Set Query = Nothing
Call UpdateStatus(Session("Reso urceID"), 1) 'RIGHT HERE
response.write "end of expire sub"
Response.Redirect "/erd/main.asp?act=expired &action=ge tharddesc& hid=" & Session("ResourceID")
End Sub
and the UpdateStatus function:
Function UpdateStatus(ResourceID, num)
strSQL3 = "sp_Update_ResourceStatus @ResourceID=" & ResourceID
If num = 2 Then
strSQL3 = strSQL3 & ", @Status=" & 2
Set Query3 = objConnection.Execute(strS QL3)
elseif num = 1 Then
strSQL3 = strSQL3 & ", @Status=" & 1
Set Query3 = objConnection.Execute(strS QL3)
End If
End Function
Prior to this, this was the function updating the status which was happening after ResDetail was being run by the resourcefull variable in hard_desc.asp:
Function StatusColor(EmployeeID, ResourceID)
Dim totalused, status, totalspace
strSQL3 = "sp_Get_DiskSpaceUsed @ResourceID=" & ResourceID
Set Query3 = objConnection.Execute(strS QL3)
status = "open"
totalused = 0
If Not Query3.EOF Then
totalspace = Query3("totalspace") '### Total space of resource
else
totalspace = 0
End If
Set Query3 = Query3.NextRecordSet
'### get total space used by all users for this resource and set flag
If NOT Query3.EOF Then
Do While NOT Query3.EOF
totalused = totalused + Query3("spaceused") '### combines space used from users of resource
Query3.MoveNext
Loop
End If
Set Query3 = Nothing
'### Check space left; Leave 30 gigs free or else full
'response.write "totalused: " & totalused & "totalspace: " & totalspace - 31
If CInt(totalspace) >= 50 Then
If Cint(totalused) >= (CInt(totalspace)-30) Then
status = "full"
End If
elseif CInt(totalspace) <= 50 Then
If Cint(totalused) >= (CInt(totalspace)-10) Then
status = "full"
End If
End If
'### Check to see if I'm using this resource and set flag if so
strSQL3 = "sp_Check_DoIUseThisResour ce @CheckedOutByID=" & EmployeeID & ", @ResourceID=" & ResourceID
Set Query3 = objConnection.Execute(strS QL3)
If status = "full" AND Query3.EOF Then 'if full and I don't use this resource
status="full"
End If
If NOT Query3.EOF and status <> "full" Then 'if full and I do not use this resource
status = "me"
elseif NOT Query3.EOF and status = "full" Then 'if full and I do not use this resource
status ="me_full"
End If
set Query3 = Nothing
strSQL3 = "sp_Update_ResourceStatus @ResourceID=" & ResourceID
Select Case status
Case "open"
'strSQL3 = strSQL3 & ", @Status=" & 1 'Open
'Set Query3 = objConnection.Execute(strS QL3)
StatusColor = "<img src=""images/gr.gif"" border=""0"">"
Case "full"
'strSQL3 = strSQL3 & ", @Status=" & 2 'Full
'Set Query3 = objConnection.Execute(strS QL3)
StatusColor = "<img src=""images/rd.gif"" border=""0"">"
Case "me"
'strSQL3 = strSQL3 & ", @Status=" & 1 'Open
StatusColor = "<img src=""images/bg.gif"" border=""0"">"
Case "me_full"
'strSQL3 = strSQL3 & ", @Status=" & 2 'Full
'Set Query3 = objConnection.Execute(strS QL3)
StatusColor = "<img src=""images/rb.gif"" border=""0"">"
End Select
End Function
I want to thank all who stuck with me....I can't tell you enough how much I appreciate it. You tought me more on how to troubleshoot this sort of thing also!!!!!!!
So I had to make status = 1 in the actual AddUser Sub
And for the Expire Sub, i had to make the status = 1 right after I removed the user.
Prior, I was doing this in the StatusColor function call in my main.asp. Since the little red dots were updating from my main, I figured that this happened before the hard_desc was rendering but it wasn't.
So in other words, my StatusColor is the one that I had changing the status to 1 or 2 and also wrote the jpg color to the screen. That status update was happening after resourcename variable was calling the ResDetail function. I thought this wasn't so but it is.
So I created a function to call at the end of both the Sub AddUser and the Sub Expire, right after the AddUser function adds the user, or rigth after the Expire deletes the user like this:
Sub Expire(EmployeeID, whoexpired)
strSQL = "sp_DoExpireResourceUsage "
strSQL = strSQL & " @ResourceID = '" & Session("ResourceID") & "',"
strSQL = strSQL & " @WhoStoppedUse = '" & Cint(whoexpired) & "',"
strSQL = strSQL & " @CheckedOutByID = '" & EmployeeID & "',"
strSQL = strSQL & " @AdminID = '" & Session("EmployeeID") & "',"
strSQL = strSQL & " @RemovedDate = '" & Now() & "'"
Set Query = objConnection.Execute(strS
Set Query = Nothing
Call UpdateStatus(Session("Reso
response.write "end of expire sub"
Response.Redirect "/erd/main.asp?act=expired
End Sub
and the UpdateStatus function:
Function UpdateStatus(ResourceID, num)
strSQL3 = "sp_Update_ResourceStatus @ResourceID=" & ResourceID
If num = 2 Then
strSQL3 = strSQL3 & ", @Status=" & 2
Set Query3 = objConnection.Execute(strS
elseif num = 1 Then
strSQL3 = strSQL3 & ", @Status=" & 1
Set Query3 = objConnection.Execute(strS
End If
End Function
Prior to this, this was the function updating the status which was happening after ResDetail was being run by the resourcefull variable in hard_desc.asp:
Function StatusColor(EmployeeID, ResourceID)
Dim totalused, status, totalspace
strSQL3 = "sp_Get_DiskSpaceUsed @ResourceID=" & ResourceID
Set Query3 = objConnection.Execute(strS
status = "open"
totalused = 0
If Not Query3.EOF Then
totalspace = Query3("totalspace") '### Total space of resource
else
totalspace = 0
End If
Set Query3 = Query3.NextRecordSet
'### get total space used by all users for this resource and set flag
If NOT Query3.EOF Then
Do While NOT Query3.EOF
totalused = totalused + Query3("spaceused") '### combines space used from users of resource
Query3.MoveNext
Loop
End If
Set Query3 = Nothing
'### Check space left; Leave 30 gigs free or else full
'response.write "totalused: " & totalused & "totalspace: " & totalspace - 31
If CInt(totalspace) >= 50 Then
If Cint(totalused) >= (CInt(totalspace)-30) Then
status = "full"
End If
elseif CInt(totalspace) <= 50 Then
If Cint(totalused) >= (CInt(totalspace)-10) Then
status = "full"
End If
End If
'### Check to see if I'm using this resource and set flag if so
strSQL3 = "sp_Check_DoIUseThisResour
Set Query3 = objConnection.Execute(strS
If status = "full" AND Query3.EOF Then 'if full and I don't use this resource
status="full"
End If
If NOT Query3.EOF and status <> "full" Then 'if full and I do not use this resource
status = "me"
elseif NOT Query3.EOF and status = "full" Then 'if full and I do not use this resource
status ="me_full"
End If
set Query3 = Nothing
strSQL3 = "sp_Update_ResourceStatus @ResourceID=" & ResourceID
Select Case status
Case "open"
'strSQL3 = strSQL3 & ", @Status=" & 1 'Open
'Set Query3 = objConnection.Execute(strS
StatusColor = "<img src=""images/gr.gif"" border=""0"">"
Case "full"
'strSQL3 = strSQL3 & ", @Status=" & 2 'Full
'Set Query3 = objConnection.Execute(strS
StatusColor = "<img src=""images/rd.gif"" border=""0"">"
Case "me"
'strSQL3 = strSQL3 & ", @Status=" & 1 'Open
StatusColor = "<img src=""images/bg.gif"" border=""0"">"
Case "me_full"
'strSQL3 = strSQL3 & ", @Status=" & 2 'Full
'Set Query3 = objConnection.Execute(strS
StatusColor = "<img src=""images/rb.gif"" border=""0"">"
End Select
End Function
I want to thank all who stuck with me....I can't tell you enough how much I appreciate it. You tought me more on how to troubleshoot this sort of thing also!!!!!!!
<% response.expires = -1 %>
This will cause your asp page not to cache.
jk