#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    ASP error from replacement of deprecated html tags


    Odd situation here (to me, anyway). Hugest thanks if you can help me solve it!
    I have an ASP page that works great. It connects to a database, retrieves information and displays it in a table. I just want to update the html to current standards. When I attempt to disuse deprecated tags, I get this error message displayed where indicated below: "An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here</a> to find out more about this error." Of course the link is too general (or I'm not smart enough) to shed any light on the problem causing the issue.
    Here's the really odd thing: with the first try at the update, the error was thrown, I visited the link in the error message, and then when I hit the back button to return to the asp page, IT DISPLAYED CORRECTLY! (forehead slap and a WTF). Refreshing the page threw the error again.
    I've also tried changing single quotation marks for double double quotation marks within the vbscript; remarking out lines and stepping through them one by one to isolate the error. I just don't have enough savvy to suss it out
    The working version is in black, with lines that have changed syntax or been added in green, and comments in red. Thanks again to all.

    Code:
    <%@ LANGUAGE="VBSCRIPT" %>
    <%   
    Option Explicit
    
    	'Response.Buffer = True
    
    	'Check if user is logged in
    	If Session("name") = "" and Session("number")="" Then
    		'If not, go to login page
    		Response.Redirect("login.asp")
    	End If
    
    	If Request.Cookies("Pvp91sZG") = "PhdZuT7O" Then
    		Response.Redirect("../AccessDenied.htm")
    	End If
    
    	If Request.Cookies("dhcpFn4H") = "2twVlXrx" Then
    
    		Dim strIP
    		Dim conn			
    		Dim rs			
    		Dim strSQL			
    		Dim strConnection		
    		Dim AcctNum
    		Dim i
    		Dim InOut
    		Dim temp
    		Dim Content
    
    		Content = ""
    
    		Set conn = Server.CreateObject("ADODB.Connection")
    		Set rs = Server.CreateObject("ADODB.Recordset")
    
    		strConnection = "FILEDSN=" & Server.MapPath("SACA.dsn") & ";DBQ=" & Server.MapPath(Session("db")) & ";"
    
    		AcctNum = Session("number")
    
    		conn.Open strConnection
    
    		strSQL = "SELECT nfldButton, nfldItemNum, ynfldCheckInOut, tfldArtist, tfldTitle, tfldMedia, tfldLocation FROM tblItems WHERE nfldAccountNum=" & AcctNum & " ORDER BY idxItems ASC;"
    
    		InOut = array("IN", "OUT")
    
    		set rs = conn.Execute (strSQL)
    
    		If (rs.BOF and rs.EOF) Then
    			Response.Write "No records have yet been entered for this account."
    			Response.End
    
    			rs.Close
    			conn.close
    			set rs=nothing
    			set conn=nothing
    			Response.End
    		End If
    
    		Response.Write("<TITLE>" & Session("name") & " Collection</TITLE>")
    		Response.write("<left><b>" & Session("name") & " Collection, Account #" & Session("number") & "<br><a href=logout.asp>Logout</a></b></left><br>") Replaced with:
                    Response.write("<b>" & Session("name") & " Collection, Account #" & Session("number") & "<br><a href='logout.asp'>Logout</a></b><br>")
    
    		Content = Content & "<FORM NAME=frmSearch METHOD=POST ACTION=clxnsrch.asp>"
    		Content = Content & "<TR><TD Align=right><b>Search for:</b> <input type=text name=txtTerms size=25>    <b>Search in:</b> " & _ Replaced with:
    		Content = Content & "<tr><td style='text-align: right;'><b>Search for:</b> <input type=text name=txtTerms size=25>    <b>Search in:</b> " & _
    		"<select name=selField size=1>" & _
      					"<option value=Artist>Artist</option>" & _
      					"<option value=Title>Title</option>" & _
      					"<option value=Media>Media</option>" & _
      					"<option value=Location>Location</option>" & _
      					"<option value=All>All</option>" & _
    				"</select>  " & _
    				"<input type=submit name=btnSearch value=Search></TD></TR></FORM>"
    	Else
    		Response.Redirect("login.asp")
    	End If
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"> Added
    
    <HTML>
    <HEAD>
    	<style type="text/css">
    	<!--
    	INPUT {
       		font-family: ;
       		font-size: ;
       		font-weight: ;
       		color: ;
       		background-color: ;
       		padding: ;
       		height: ;
       		width: ;
    	} 
    	INPUT.GoButton { 
    		background-color: ; 
    		border-color: ;
    		color: ; 
    		font-family: arial, verdana, ms sans serif; 
    		font-weight: normal; 
    		font-size: 6pt; 
    		text-align: center; 
    		height: 15px; 
    		width: 40px;
    	} 
    	--> 
    	</style>
    </HEAD>
    
    <BODY> Replaced with:
    <body style="background-color: white; text-align: left;">
    
    <br>
    
    <div style="text-align: center;">
    <div style="width: 85%; margin-left: auto; margin-right: auto;"> Added
    
    <TABLE Align = "Center" BORDER="0" CELLPADDING="2" CELLSPACING="2" WIDTH="85%"> Replaced with:
    <table style="border: none; border-spacing: 2px; padding: 2px; width: 85%; text-align: center; margin: auto;">
    
    	<%
    	Response.Write(Content)
    	%>
    </TABLE>
    			
    <TABLE Align = "Center" BORDER="1" CELLPADDING="2" CELLSPACING="2" WIDTH="85%"> Replaced with:
    <table style="border: 1px; border-spacing: 2px; padding: 2px; width: 85%; text-align: center; margin: auto;">
    <%
    	Response.Write "<TR BGCOLOR=""#CCCCCC""><TH> </TH><TH>Item Number</TH><TH>IN / OUT</TH><TH>Artist</TH><TH>Title</TH><TH>Media</TH><TH>Location</TH></TR>" Replaced with:
    	Response.Write "<tr style='background-color: #CCCCCC;'><th> </th><th>Item Number</th><th>IN / OUT</th><th>Artist</th><th>Title</th><th>Media</th><th>Location</th></tr>"
    
    All the above amendments in green seem to be working fine
    
    	rs.MoveFirst
    
    	Do While Not rs.EOF
    		Response.Write "<TR><FORM Action='item.asp' Method='Post'>" Error occurs somewhere from here on
    
    		For i = 0 to rs.Fields.Count - 1
    
    		temp = rs.Fields(i)
    		tdata = "<b><td style='font-family: arial; font-size: xx-small;" added variable to eliminate using <font> and <center>
    
    		If i = 0 Then
    			temp = "</b></font><center><INPUT Type=Hidden Name='ItemNumber' Value=" & rs("nfldItemNum") & "><input type=Submit value=Go class='GoButton'></center><font><b>" Replaced with:
    			temp = " text-align: center;'></b><input type=hidden name='ItemNumber' value=" & rs("nfldItemNum") & "><input type=submit value='Go' class='GoButton'><b>"
    
    		End If
    
    		If i = 1 Then 
    			temp = "<center>" & temp & "</center>" Replaced with:
    			temp = " text-align: center;'>" & temp
    		End If
    
    		If i = 2 Then
    			If temp + 1 = 0 Then 
    				temp = "</font><font FACE=""ARIAL"" SIZE=""1"" color = ""#009900""><center>" & InOut(temp + 1) & "</center></font>" Replaced with:
    				temp = " color: #009900; text-align: center;'>" & InOut(temp + 1)
    			Else
    				If temp + 1 = 1 Then 
    					temp = "</font><font FACE=""ARIAL"" SIZE=""1"" color = ""#FF0000""><center>" & InOut(temp + 1) & "</center></font>" Replaced with:
    					temp = " color: #FF0000; text-align: center;'>" & InOut(temp + 1)
    				End If
    			End If
    		End If
    
    		If i = 4 Then temp = "<i>" & temp & "</i>"
    
            	It seems that assembling the table as in green below, incorporating the above green variables, is where the error is generated
    
            	Response.Write "<TD><FONT FACE=""ARIAL"" SIZE=""1""><b>" & temp & "</b></font></TD>" Replaced with:
            	Response.Write tdata & "" & temp & "</b></td>"  The table displayed correctly only when I left the page and then used the browser's back button! I also tried instead of this line:
    
            	Response.Write(tdata)
            	Response.Write(temp) & "</b></td>" also tried:
    
            	WriteData = tdata & "" & temp & "</b></td>" added a variable to hold both values and include closing tags
            	Response.Write(WriteData)
    
    		Next
    		Response.write "</FORM></TR>"
    
    		rs.MoveNext
    	Loop
    
    	rs.Close
    	set rs = Nothing
    	conn.Close
    	set conn = Nothing
    %>
    
    </TABLE>
    </div>
    </div> Added
    </BODY>
    </HTML>
  2. #2
  3. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0
    This won't probably won't help much but i just want to correct this line.. Isn't it would be better to do an Else If?

    If i = 0 Then
    temp = "</b></font><center><INPUT Type=Hidden Name='ItemNumber' Value=" & rs("nfldItemNum") & "><input type=Submit value=Go class='GoButton'></center><font><b>" Replaced with:
    temp = " text-align: center;'></b><input type=hidden name='ItemNumber' value=" & rs("nfldItemNum") & "><input type=submit value='Go' class='GoButton'><b>"

    End If

    If i = 1 Then
    temp = "<center>" & temp & "</center>" Replaced with:
    temp = " text-align: center;'>" & temp
    End If

    If i = 2 Then
    If temp + 1 = 0 Then
    temp = "</font><font FACE=""ARIAL"" SIZE=""1"" color = ""#009900""><center>" & InOut(temp + 1) & "</center></font>" Replaced with:
    temp = " color: #009900; text-align: center;'>" & InOut(temp + 1)
    Else
    If temp + 1 = 1 Then
    temp = "</font><font FACE=""ARIAL"" SIZE=""1"" color = ""#FF0000""><center>" & InOut(temp + 1) & "</center></font>" Replaced with:
    temp = " color: #FF0000; text-align: center;'>" & InOut(temp + 1)
    End If
    End If
    End If

    If i = 4 Then temp = "<i>" & temp & "</i>"

    It seems that assembling the table as in green below, incorporating the above green variables, is where the error is generated

    Response.Write "<TD><FONT FACE=""ARIAL"" SIZE=""1""><b>" & temp & "</b></font></TD>" Replaced with:
    Response.Write tdata & "" & temp & "</b></td>" The table displayed correctly only when I left the page and then used the browser's back button! I also tried instead of this line:

    Response.Write(tdata)
    Response.Write(temp) & "</b></td>" also tried:

    WriteData = tdata & "" & temp & "</b></td>" added a variable to hold both values and include closing tags
    Response.Write(WriteData)

    Next
    Response.write "</FORM></TR>"

    rs.MoveNext
    Loop

    rs.Close
    set rs = Nothing
    conn.Close
    set conn = Nothing
    %>
  4. #3
  5. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,594
    Rep Power
    278
    One things I'll never understand is why people make so complicated code when it is not need it and can not manage that code....
    Why you building all your table in variable and after that response,write almost full page? off cause you have number off errors, like you open " and close ' and of cause html will not validate that...
    if you need change style in td why not use something like (BY THE WAY <B> BEFORE td IS WRONG...)
    <td style="font-family: arial; font-size: xx-small;
    <%
    If i = 0 Then
    %>
    </center><font><b>" Replaced with:-->
    text-align: center;"></b>
    <input type="hidden" name='ItemNumber' value="<%=rs("nfldItemNum")%>">
    <input type="submit" value='Go' class='GoButton'><b>
    <%
    End If
    If i = 1 Then
    %>
    text-align: center;">
    <%
    End If
    %>

    and so on match simpler and less possibilities to make a mistakes
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
  6. #4
  7. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    Thank you for your replies. I've got it all fixed up now. There were a couple of errors which in hindsight should have been obvious to me. Here's the new version, if anyone's interested:

    Code:
    <%@ LANGUAGE="VBSCRIPT" %>
    <%   
    Option Explicit
    
       'Response.Buffer = True
    
       'Check if user is logged in
       If Session("name") = "" and Session("number")="" Then
          'If not, go to login page
          Response.Redirect("login.asp")
       End If
    
       If Request.Cookies("Pvp91sZG") = "PhdZuT7O" Then
          Response.Redirect("../AccessDenied.htm")
       End If
    
       If Request.Cookies("dhcpFn4H") = "2twVlXrx" Then
    
          Dim strIP
          Dim conn			
          Dim rs			
          Dim strSQL			
          Dim strConnection		
          Dim AcctNum
          Dim i
          Dim InOut
          Dim temp
          Dim Content
    
          Content = ""
    
          Set conn = Server.CreateObject("ADODB.Connection")
          Set rs = Server.CreateObject("ADODB.Recordset")
    
          strConnection = "FILEDSN=" & Server.MapPath("SACA.dsn") & ";DBQ=" & Server.MapPath(Session("db")) & ";"
    
          AcctNum = Session("number")
    
          conn.Open strConnection
    
          strSQL = "SELECT nfldButton, nfldItemNum, ynfldCheckInOut, tfldArtist, tfldTitle, tfldMedia, tfldLocation FROM tblItems WHERE nfldAccountNum=" & AcctNum & " ORDER BY idxItems ASC;"
    
          InOut = array("IN", "OUT")
    
          set rs = conn.Execute (strSQL)
    
          If (rs.BOF and rs.EOF) Then
             Response.Write "No records have yet been entered for this account."
             Response.End
    
             rs.Close
             conn.close
             set rs=nothing
             set conn=nothing
             Response.End
          End If
    
          Response.Write("<title>" & Session("name") & " Collection</title>")
          Response.write("<b>" & Session("name") & " Collection, Account #" & Session("number") & "<br><a href='logout.asp'>Logout</a></b><br>")
    
          Content = Content & "<form name=frmSearch method=post action=clxnsrch.asp>"
          Content = Content & "<tr><td style='text-align: right;'><b>Search for:</b>*<input type=text name=txtTerms size=25> ***<b>Search in:</b>*" & _
             "<select name=selField size=1>" & _
                "<option value=Artist>Artist</option>" & _
                "<option value=Title>Title</option>" & _
                "<option value=Media>Media</option>" & _
                "<option value=Location>Location</option>" & _
                "<option value=All>All</option>" & _
             "</select> *" & _
             "<input type=submit name=btnSearch value=Search></td></tr></form>"
       Else
             Response.Redirect("login.asp")
       End If
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
       <head>
    
          <style type="text/css">
             <!--
    
    	 input.GoButton { 
    	    background-color: ; 
    	    border-color: ;
    	    color: ; 
    	    font-family: arial, verdana, ms sans serif; 
    	    font-weight: normal; 
    	    font-size: 6pt; 
    	    text-align: center;
    	    width: 40px; 
    	    display: table-cell;
    	    vertical-align: middle;
    	    } 
    	 --> 
          </style>
    
       </head>
    
       <body style="background-color: white; text-align: left;">
          <br>
             <div style="text-align: center;">
             <div style="width: 85%; margin-left: auto; margin-right: auto;">
    
             <table style="border: none; border-spacing: 2px; padding: 2px; width: 85%; text-align: center; margin: auto;">
    
    	    <%
    	    Response.Write(Content)
    	    %>
    
             </table>
    			
        	 <table style="border-style: solid; border-spacing: 2px; border-width: 2px; border-color:#CCCCCC; padding: 2px; width: 85%; margin: auto;">
    
    	    <%
    	    Response.Write "<tr style='background-color: #CCCCCC;'><th> </th><th>Item Number</th><th>IN / OUT</th><th>Artist</th><th>Title</th><th>Media</th><th>Location</th></tr>"
    
    	    rs.MoveFirst
    
    	    Do While Not rs.EOF
    	       Response.Write "<tr><form action='item.asp' method='post'>"
    
    	       For i = 0 to rs.Fields.Count - 1	  
    
    	       temp = rs.Fields(i)
    
    	       If i = 0 Then
    		  temp = " text-align: center;'><input type=hidden name='ItemNumber' value=" & rs("nfldItemNum") & "><input type=submit value=Go class='GoButton'>"
    	       End If
    
    	       If i = 1 Then
    	          temp = " text-align: center;'>" & temp
    	       End If
    
    	       If i = 2 Then
    	          If temp + 1 = 0 Then
    	             temp = " text-align: center; color: #009900;'>" & InOut(temp + 1)
    	          Else
    	             If temp + 1 = 1 Then
    	                temp = " text-align: center; color: #FF0000;'>" & InOut(temp + 1)
    	             End If
    	          End If
    	       End If
    
    	       If i = 3 Then
    		  temp = " text-align: left;'>" & temp
    	       End If
    
    	       If i = 4 Then
    		  temp = " text-align: left;'><i>" & temp & "</i>"
    	       End If
    
    	       If i > 4 Then
    		 temp = " text-align: left;'>" & temp
    	       End If
    
    	       Response.Write "<td style='font-family: arial; font-size: xx-small; font-weight: bold; border-style: solid; border-width: 1px; border-color: #CCCCCC;" & temp & "</td>" 'HTML 5.0
    
    	       Next
    	       Response.write "</form></tr>"
    
    	       rs.MoveNext
    	    Loop
    
    	    rs.Close
    	    set rs = Nothing
    	    conn.Close
    	    set conn = Nothing
    	    %>
    
              </table>
              </div>
              </div>
       </body>
    </html>

Similar Threads

  1. Modyfing replacement script from html to doc
    By Anandajoti in forum Windows Scripting
    Replies: 3
    Last Post: March 10th, 2011, 12:44 AM
  2. Remove HTML tags from RS
    By keedowah in forum ASP Development
    Replies: 1
    Last Post: September 23rd, 2005, 10:33 AM
  3. html tags inside asp
    By Trainer in forum ASP Development
    Replies: 7
    Last Post: August 17th, 2005, 04:51 PM
  4. how to search for all img tags in a html doc
    By esocx in forum ASP Development
    Replies: 3
    Last Post: October 2nd, 2003, 12:43 AM

IMN logo majestic logo threadwatch logo seochat tools logo