|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Odd behaviour
Here is a puzzling one,
I have an aspx page with a code behind file, for some reason all of a sudden the page skips processing some of the lines, simple if tests for examples. I even created a web service, and enscapulated my code in there to do what I needed to do. The pages hits the line to call the web service, but does nothing. No error or anything. Same thing with the if tests, I have a session variable which may or may not contain the value of "True" or "False" I do a simple if test, testing its value and then do some processing based on it, it simply skips over it. Anyone seen anything close to this odd behaviour before ???? |
|
#2
|
|||
|
|||
|
sounds like the test is failing, simple as that. Post your code
|
|
#3
|
|||
|
|||
|
Code - HELP PLEASE
Ok this is really starting to freak me. I went back today to take a fresh look at this thing ,, the code on the code behind file processes and then it very conveniently simply exits out of the routine before executing the If block where it tests the Session variables. (See code below) if anyone has any idea on this one, please holler up .
CODE ------------------------------------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strHTML As String Dim owebsr As localhost1.Service1 owebsr = New localhost1.Service1 Dim oMenus As localhost2.Service1 = New localhost2.Service1 Dim MenuForstring As String ' This code executes fine Me.TDStats.InnerHtml = "<FONT face='Arial' size='1'>Animals in System = " & owebsr.GetAnimalCnt(Session("ConnString")) & "</FONT>" Me.TDStats2.InnerHtml = "<FONT face='Arial' size='1'> Breeders in System = " & owebsr.GetBreederCnt(Session("ConnString")) & "</FONT>" Me.TDStats3.InnerHtml = " <FONT face='Arial' size='1'> Owners in System = " & owebsr.GetOwnerCnt(Session("ConnString")) & "</FONT>" If Session("Bab_Admin_b") = "True" Then strHTML = "" strHTML = strHTML & "<IMG onmouseover=" & Chr(34) & "this.src='Images/breedersOv.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/breedersT.gif';" & Chr(34) strHTML = strHTML & "src='Images/breedersT.gif'><IMG onmouseover=" & Chr(34) & "this.src='Images/Ownersov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/OwnersT.gif';" _ & Chr(34) & "src='Images/OwnersT.gif'><IMG onmouseover=" & Chr(34) & "this.src='Images/Logonov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onclick=" & Chr(34) & "poopen('Login.aspx')" _ & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/LogonT.gif';" & Chr(34) & "src='Images/LogonT.gif'> <IMG onmouseover=" & Chr(34) & "this.src='Images/UsersListO.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onclick=" & Chr(34) & "poopen('Admin_Users.aspx')" _ & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/UsersListT.gif';" & Chr(34) & "src='Images/UsersListT.gif'> <IMG onmouseover=" & Chr(34) & "this.src='Images/searchov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/searchT.gif';" _ & Chr(34) & "src='mages/searchT.gif'> <IMG onmouseover=" & Chr(34) & "this.src='Images/ContactUsov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/ContactUsT.gif';" _ & Chr(34) & "src='Images/ContactUsT.gif'>" Me.TDMENUBAR.InnerHtml = strHTML Else strHTML = "" strHTML = strHTML & "<IMG onmouseover=" & Chr(34) & "this.src='Images/breedersOv.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/breedersT.gif';" & Chr(34) strHTML = strHTML & "src='Images/breedersT.gif'><IMG onmouseover=" & Chr(34) & "this.src='Images/Ownersov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/OwnersT.gif';" _ & Chr(34) & "src='Images/OwnersT.gif'><IMG onmouseover=" & Chr(34) & "this.src='Images/Logonov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onclick=" & Chr(34) & "poopen('Login.aspx')" _ & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/LogonT.gif';" & Chr(34) & "src='Images/LogonT.gif'> <IMG onmouseover=" & Chr(34) & "this.src='Images/RegisterO.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onclick=" & Chr(34) & "poopen('UsersEntry.aspx')" _ & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/RegisterT.gif';" & Chr(34) & "src='Images/RegisterT.gif'> <IMG onmouseover=" & Chr(34) & "this.src='Images/searchov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/searchT.gif';" _ & Chr(34) & "src='Images/searchT.gif'> <IMG onmouseover=" & Chr(34) & "this.src='Images/ContactUsov.gif';" & Chr(34) & "style=" & Chr(34) & "vAlign: top" & Chr(34) & "onmouseout=" & Chr(34) & "this.src='Images/ContactUsT.gif';" _ & Chr(34) & "src='Images/ContactUsT.gif'>" Me.TDMENUBAR.InnerHtml = strHTML End If ' Routine bails out here , and does not process the code below If Session("Bab_Admin_b") = "True" Then MenuForstring = "Admin" End If If Session("Bab_Breeder_b") = "True" Then MenuForstring = "Breeder" End If If Session("Bab_Owner_b") = "True" Then MenuForstring = "Owner" End If If Session("Bab_User_b") = "True" Then MenuForstring = "User" End If Dim s As String oMenus = New localhost2.Service1 s = oMenus.GetMenuFor(MenuForstring) End Sub |
|
#4
|
|||
|
|||
|
careful how you post code on this forum! It's a bit poor
I'm looking at this now, and the first thing I noticed - you should use a StringBuilder to concatenate large strings the way you are doing, It's much neater, and much faster. but I digress. re where the routine bails out:
Code:
Routine bails out here , and does not process the code below
If Session("Bab_Admin_b") = "True" Then
MenuForstring = "Admin"
End If
If Session("Bab_Breeder_b") = "True" Then
MenuForstring = "Breeder"
End If
If Session("Bab_Owner_b") = "True" Then
MenuForstring = "Owner"
End If
If Session("Bab_User_b") = "True" Then
MenuForstring = "User"
End If
what are the actual values stored in session for these values? try Debug.WriteLine-ing them if you're using VS.NET, if not, Response.Write them out. Where are you setting these values? Don't forget that Session values in .NET are not Variant like in classic asp, you need to cast them to strings. Or Booleans, depending on your taste. re the bit afterwards: Code:
Dim s As String oMenus = New localhost2.Service1 s = oMenus.GetMenuFor(MenuForstring) End Sub well that clearly won't appear to do anything unless you make use of the s variable later. hth Leon |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > Odd behaviour |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|