We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Invalid Character

Medium Priority
682 Views
Last Modified: 2013-12-03
I migrated an asp.net application from 1 server to another. Now on one of the pages i am getting  a 'invalid character' error on some javascript generated by the asp. Ive checked versions..and both the same.  
Basically it is a little piece of javascript that when you click the down arrow and choose a value - it is supposed to fill in the next drop down. on loading the page it is fine-then when you push the down arrow - it errors out the IE Browser with Error: Invalid Character, line 1, char 2.

Much help is needed! Ive been working on this for days..

This is the code:

<!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >-->
<HTML>
      <HEAD>
            <title>Associate User To Entity</title>
            <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
            <meta content="C#" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
            <LINK href="/CBF/CSS/CBF.css" rel="stylesheet" type="text/css">
            <SCRIPT language="vbscript" type="text/vbscript">

   <!--

   Sub ClientValidateOnAdd(source, arguments)
           
      If Len(Trim(source)) = 0 Then
         arguments.IsValid=False
      Else
         arguments.IsValid=True
      End If

   End Sub

   -->

            </SCRIPT>
      </HEAD>
      <body>
            <form name="Entities" method="post" action="AssociateUserToEntityAndReportType.aspx" id="Entities">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTIxMzI1NTI5ODAPZBYCAgEPZBYGAgMPEA8WAh4LXyFEYXRhQm91bmRnZBAVDAEgCUFsYW1vd2luZwVMZWdhbAVPdGhlcgVSICYgSApSZWFsZXN0YXRlBVJpb2NvB1Jpb3dpbmcHUm9ja2llcwlTYW5kcG9pbnQKU3RhbXBjcmV0ZQtUZXN0IEVudGl0eRUMATACNTcCNTgCNTUCNTkCNTICNTQCNDUCNDkCNTMCNTACNDMUKwMMZ2dnZ2dnZ2dnZ2dnFgFmZAIFDxBkZBYAZAIHDzwrAAsAZGTnAT0fYY6tARUmptLJ2aninXdpGg==" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['Entities'];
if (!theForm) {
    theForm = document.Entities;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
      //setTimeout("_doPostBack()", 1000);
}
// -->
</script>


<table id="Table1" cellspacing="0" cellpadding="0" width="100%" border="0">
      <tr>
            <td width="1%"><img src="/CBF/Images/banner-left.gif" border="0"></td>
            <!--<td width="98%" background="/CBF/Images/banner-mid-bg.gif"></td>-->
            <td width="98%"><img src="/CBF/Images/banner-mid-bg.gif" width="100%" height="20"></td>
            <td><img src="/CBF/Images/banner-right.gif"></td>
      </tr>
</table>
<table height="40" cellspacing="0" cellpadding="0" width="100%" border="0">
      <tr>
            <td valign="top" align="left" width="1%" height="27"><img src="/CBF/Images/top-left.gif"></td>
            <td width="98%" height="27"><font class="clsFunctionalArea">Associate User to Entity</font></td>
            <td width="1%" height="27"><table height="17" cellspacing="0" cellpadding="0" border="0">
                        <tr>
                              <td width="10"><img height="20" src="/CBF/images/menu-top-left.gif" width="10"></td>
                              <td align="center" bgcolor="#336699" nowrap><font face="Verdana" size="2" color="#fffff">CBF Administrator : Friday, October 27, 2006 - CST</font>&nbsp;</td>
                        </tr>
                  </table>
            </td>
      </tr>
</table>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
      <tr>
            <td width="1%" valign="top"><table cellspacing="0" cellpadding="3" width="170" border="0"><tr><td class=clsMenuHeader>Reports</td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="ReportSelection.aspx">Run Reports</a></td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="SystemReports.aspx">System Reports</a></td></tr><tr><td><br></td></tr><tr><td class=clsMenuHeader>Maintenance</td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="MaintainUsers.aspx">Users</a></td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="MaintainEntities.aspx">Entities</a></td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="MaintainReportTypes.aspx">Report Types</a></td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="AssociateUserToEntityAndReportType.aspx">Associations</a></td></tr><tr><td class=clsMenuItem><a class=clsMenuItem href="MaintainReports.aspx">Reports</a></td></tr><tr><td><br></td></tr><tr><td class=clsMenuHeader><a class=clsMenuHeader href=".\Default.aspx">Log Off</a></td></tr></table></td>
            <td valign="top" align="left" width="96%" class="clsStandardText"><br>
                  
                  
                  
                  
                  <P><STRONG>
                              <BR>
                              Select an Entity:</STRONG>
                        <select name="ddlEntity" onchange="javascript:setTimeout('__doPostBack(\'ddlEntity\',\'\')', 0)" id="ddlEntity" style="font-size:XX-Small;">
      <option selected="selected" value="0"> </option>
      <option value="58">Legal</option>
      <option value="55">Other</option>
      <option value="59">R &amp; H</option>
      <option value="52">Realestate</option>
      <option value="43">Test Entity</option>

</select></P>
                  
        <P><STRONG>Select a Report Type:</STRONG>
          <select name="ddlReportTypes" onChange="javascript:setTimeout('__doPostBack(\'ddlReportTypes\',\'\')', 0)" id="ddlReportTypes" style="font-size:XX-Small;">
          </select>
        </P>
                  <P>
                        <TABLE id="Table1" style="WIDTH: 644px; HEIGHT: 20px" cellSpacing="1" cellPadding="1" width="644"
                              border="0">
                        </TABLE>
                  </P>
                  <STRONG>Check the Associated Beneficiaries:</STRONG><BR>
                  <BR>
                  <HR class="#c7ccdc" width="100%" SIZE="1">
                  <P align="center"><input type="submit" name="btnSave" value="Save" id="btnSave" class="Button" />&nbsp;
                        <input type="submit" name="btnCancel" value="Cancel" id="btnCancel" class="Button" /></P>
                  &nbsp;
</td> </tr> </table>
<div>

      <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWEQLz5svFBgKF+dSmDAKVlv5IAo6WmksCjpbeSAKOloJLAo6W0kgCjpa2SwKOlo5LAomWgksCiZbSSAKOlopLAo6WvksCiZaKSwKf1ODCDgKct7iSDAKQ9M/rBR4iU39h7E+dCjpohXaD7tVjg3PY" />
</div></form>
      </body>
</HTML>
Comment
Watch Question

b0lsc0ttIT Manager
CERTIFIED EXPERT
Commented:
renet123,

Try changing the first line.  You should not comment out the doctype line and it seems like that is where the error is occurring.  Change the first line in the code you provided to the line below.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

Let me know if you have any questions or need more information.

b0lsc0tt

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
b0lsc0ttIT Manager
CERTIFIED EXPERT
Commented:
Most current browsers actually like this version of that line better.  In this case it displays on 2 lines just as you see below (i.e. not wrapped).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Author

Commented:
i took the 'comment out' and tried both of these methods.. and i am getting the same error. i think that it has something to do with the javascript - because the error occurs when i push the selection box and choose an option.
Commented:
Yes, you are right. The problem is with the javascript and this is what I have found wrong in your code.

onChange="javascript:setTimeout('__doPostBack(\'ddlReportTypes\',\'\')', 0)"

You have forgotten to add \ to the last (single quote) ' for the first parameter of setTimeout.

The above onChange code should be:

onChange="javascript:setTimeout('__doPostBack(\'ddlReportTypes\',\'\')\', 0)"

See if this works for you.

Yasir

Author

Commented:
ok. so i apreciate the help - and i will spread points out evenly because i apreciate the help - and i beleive that these forums should continue.  
This morning i solved this issue on my own.  If you look at my original post - i told everyone that i migrated the whole asp.net application.   Well - i migrated from a server using asp.net 1.1 to a server using asp.net 2.0.  Thankfully - asp.net can run both versions side by side - and i ran this particular application under the 1.1 instead of 2.0.
Just an FYI - the way you do this in IIS 6.0 is right click the app/web, go to the asp.net tab, and hit the drop down from 2.0 to 1.1 (you may have to install 1.1 if its not in the drop down-not sure) - then click apply - and maybe a stop-start on the website.. and it all worked after that.
b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
I'm glad that I was able to help.  Thanks for letting us know the result.  Also thank you for the grade, the points and the fun question.

bol

Commented:
It was my first answer to any of the forums here on EE and I am pleased that my effort has been greatly appreciated.

Yasir
b0lsc0ttIT Manager
CERTIFIED EXPERT

Commented:
@Yasir - Congratulations and welcome!

bol
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.