473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Response.Write not working

Hello,

in my ASP.NET c# project I can ouput text using
response.write from the code behind class. It works in the
aspx file using <asp:TextBox> controls too. It also works
using <%="Hello"%>. But using

response.write("hello");

I get the error
Compiler Error Message: CS1519: Invalid token '(' in
class, struct, or interface member declaration

Any Ideas why? Here is the complete code:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="CRS_Web.WebForm1" %>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Import Namespace="CRS_Application"%>
<%@ Import Namespace="CRS_Web"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft
Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body bgcolor="white" >
<script runat="server" language="c#">
Response.Write("Hello, Richard!" );
</script>
</body>
</HTML>

Nov 17 '05 #1
1 10344
Any code in a server side script declared via <script> tag, has to contain
functions only.

If you just need to run some lines, they need to be in <% %> blocks.

Better yet, avoid server side scripts alltogether. This is almost always
possible.

"Rich" <ms*****@richard-quinn.com> wrote in message
news:03****************************@phx.gbl...
Hello,

in my ASP.NET c# project I can ouput text using
response.write from the code behind class. It works in the
aspx file using <asp:TextBox> controls too. It also works
using <%="Hello"%>. But using

response.write("hello");

I get the error
Compiler Error Message: CS1519: Invalid token '(' in
class, struct, or interface member declaration

Any Ideas why? Here is the complete code:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="CRS_Web.WebForm1" %>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Import Namespace="CRS_Application"%>
<%@ Import Namespace="CRS_Web"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft
Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body bgcolor="white" >
<script runat="server" language="c#">
Response.Write("Hello, Richard!" );
</script>
</body>
</HTML>

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jon Spivey | last post by:
Experimenting with response.flush() but can't seem to get it to work. This code <% response.write "<p>started</p>" response.flush() for i = 1 to 10000000 i = i +1 next response.write...
35
by: Eitan | last post by:
Hello, How can I write a line (with carriage return + line feed) to the client ? response.write("abcd"), continue the last line, and doesn't put cr+lf. response.writeLn is illegal syntax... ...
8
by: Ariel Erlijman | last post by:
I have a .htm with this script in the body <SCRIPT src="\TestScriptNET\test.aspx" LANGUAGE="JavaScript" TYPE="text/javascript"></SCRIPT> And in my test.aspx Page_Load the following code: ...
1
by: csgraham74 | last post by:
Hi there, ive written a function to display some returned values in a table. I use response.write to write the values as html. My problem is that this has stopped working correctly and i find...
0
by: jose.mendez22 | last post by:
I'm trying to fire a pop-up window before I execute a lengthy stored procedure so I may utilize this window as a status window on number of records executed. After my response.write statements...
6
by: john | last post by:
The standard method to transmit a file from an aspx page to a browser is to stream the file to the response then end the response. The HTML code generated by the aspx page is discarded, and the...
3
by: Jer425 | last post by:
Hello all, I'm trying to post to another page from asp.net and direct the user there. I've looked through the group and found a lot of information. The following code may work well for what I'm...
4
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole...
5
by: twiggy182 | last post by:
Hi, I really need you help because I'm not very familliar with ASP and I could not find any solution to my problem. To put you in situation, I have a CGI to which I send a file name, and that...
0
by: musosmiffy | last post by:
Hi, I have been trying to get the following working for days - I wonder if anyone could help me? I am trying to list a set of database entries as a newspaper column. I am using classic ASP (not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.