String compiling error

Discussion in 'ASP.NET 2.0' started by paihung, Nov 28, 2005.

  1. Hi,

    I get the compiling error below, but the string looks well-formed to me. I tried compiling the same stringlocally with csc.exe, and it worked fine. What may be wrong here?

    Thanks,
    Pai-Hung




    Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1010: Newline in constant

    Source Error:







    Code:
    Line 8:    
    Line 9:    string strStartup = "<script language=\"JavaScript\">document.getElementById(\"txtUsername\").focus();</script>";
    Line 10:   RegisterStartupScript("StartupScript", strStartup);
    Line 11: }
    Source File: e:\web\seattledaoh\htdocs\__private\login.aspx Line: 9


    Show Detailed Compiler Output:





    Code:
    c:\windows\system32\inetsrv> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\__private\f3bb331d\e48dfef3\App_Web_nlaahmor.dll" /debug- /optimize+ /win32res:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\__private\f3bb331d\e48dfef3\nlaahmor.res" /w:4 /nowarn:1659;1699  "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\__private\f3bb331d\e48dfef3\App_Web_nlaahmor.0.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\__private\f3bb331d\e48dfef3\App_Web_nlaahmor.1.cs"
    
    Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
    for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
    Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
    
    warning CS1668: Invalid search path 'C:\Program Files\SQLXML 3.0\bin\' specified in 'LIB environment variable' -- 'Access is denied. '
    e:\web\seattledaoh\htdocs\__private\login.aspx(9,23): error CS1010: Newline in constant
    e:\web\seattledaoh\htdocs\__private\login.aspx(9,105): error CS1513: } expected
     
  2. I think its the backslash in the closing </script> tag causing the 'newline in constant' error.

    Try <//script>
     

Share This Page