Sam
Sam

Reputation: 1229

ASP.NET code showing on browser along with Hello Word text in IIS

I have installed IIS on Windows 7 and I am having trouble with the ASP pages.

From the tutorial I am going through the whole code below gets displayed in the browser:

<%
response.write("Hello World!")
%>

It is not displaying the Hello World! text it is displaying the code as it is above, how can I make this display correctly?

EDIT:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
    <title>Untitled Page</title>
</head>

<%
response.write("Hello World!")
%>

</body>
</html>

Upvotes: 0

Views: 5172

Answers (5)

Daniel
Daniel

Reputation: 1

Make sure that your'r URL does not begin with "file://" (in this case you are fetching the file from file system). The URL should begin with http://localhost/ etc..

Upvotes: 0

user191966
user191966

Reputation:

Capital "R" in "reponse" - AND capital "W" in "write" :)

<%
Response.Write("Hello World!")
%>

or

<%= "Hello World!" %>

Upvotes: 0

AaronS
AaronS

Reputation: 7713

It looks like from your answers so far that you're trying to run a classic ASP page, and not an ASP.net page.

By default, if your extension is .asp it's classic asp and .aspx will use the .net framework.

If you are trying to use classic asp you have to specifically enable it in windows 7. See here.

Upvotes: 1

NerdFury
NerdFury

Reputation: 19214

When you install IIS after the .NET framework, often IIS is not properly configured to serve up ASP.NET pages.

Try running the ASPNET_REGIIS -i at a command prompt.

It is likely in the Windows\Microsoft.NET\Framework\v4.0.30319 or Windows\Microsoft.NET\Framework64\v4.0.30319 directories.

You can learn more about ASPNET_REGIIS here: http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx

Upvotes: 2

Etch
Etch

Reputation: 3054

It looks like you have no start <body> tag.

Actually you are missing alot. more code to come!

Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestApp.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <%
        Response.Write("Hello World!");
    %>
    </form>
</body>
</html>

Upvotes: 1

Related Questions