Response.Write not working

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default 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>

    Rich Guest

  2. Similar Questions and Discussions

    1. response.write URL
      I have a page which lists conferences and events which the company for which I coded the site attends or hosts themselves. They want to be able to...
    2. If response.write help
      Hi, I am trying to code my asp page so that if you are on page Y, the link to page Y in the nav, is in the over state to help users identify where...
    3. quotes in response.write
      Hi there, I want to do: response.write("bla bla bla "in quotes" bla bla") How do I show the quotes on the screen in asp like I have to do \"...
    4. Response.Write and Response.Redirect
      On my Page_Load event, i need to do some validation and then either let them proceed, or display a error message and boot them back to the previous...
    5. asp response.write doesn't display
      Maybe you could start with a more barebones file, especially one without an unclosed LINK tag:
  3. #2

    Default Re: Response.Write not working

    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-news@richard-quinn.com> wrote in message
    news:034601c3507b$608b5790$a101280a@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>
    >

    Marina Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139