I'm trying to test if ASP.NET is working on my customers IIS 7.5 server, the code below works fine on my server.
<html>
<body bgcolor="yellow">
<center>
<h2>Hello</h2>
<p><%Response.Write(now())%></p>
</center>
</body>
</html>
Using the exact same text.aspx file containing the above code he gets the error:
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: CS1002: ; expected
Source Error:
Line 3: <center>
Line 4: <h2>Hello</h2>
Line 5: <p><%Response.Write(now())%></p>
Line 6: </center>
Line 7: </body>
Source File: c:\inetpub\wwwroot\myapp\test.aspx Line: 5
Any ideas why this would be? His server will be running a Swiss version of Windows (if that makes any difference).
Many many thanks. Steven
Your problem is with the following line:
<p><%Response.Write(now())%></p>
The statement needs a semicolon since you're strictly writing a C# statement (rather than using any of the binding expressions):
<p><% Response.Write(now()); %></p>
Whoops...missed part of the question.
If this is working on your local server but not the client's remote server, you should make sure that the client's remote server is set to use Visual Basic instead of C# as the language.
You can also add the Language directive directly to the *.aspx page to force the page to use the correct language:
<%@ Page Title="Your page's title" Language="VB" %>
Check the default language setting in IIS Manager. I think you will find your local machine is set to Visual Basic and the remote server will be set to C#.
IIS 7 and later
Basically your statement is Visual Basic.
<%= Response.Write("Blah") %>
This is the same statement in C#
<%= Response.Write("Blah"); %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With