ASP code does not process in ASP.NET

G

Guest

I have an asp.net webform. When I view the page in the web browser, the html
is returned but not any asp code, i.e., " <% ... %> ".

This same code works in the "old" asp page BUT NOT in asp.net.


See code below:

_________________________________________________________________-

<form action="intro2.aspx" method="post">
<h3>Name: <input id="Name" type="text"> Category:

<select id="Category" size="1">
<option>psychology</option>
<option>business</option>
<option>popular_comp</option>
</select>

</h3><input type="submit" value="Lookup">
<p>

<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>">Welcome to ASP.NET </font>
<br>
<% Next %>

</form>

_____________________________________________________________
 
K

Kevin Spencer

I have a Ferrari. I took the engine out of my Volkswagon and put it in the
Ferrari. Now the Ferrari doesn't run. Why doesn't my Ferrari run with a
Volkswagon engine?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
G

Guest

Kevin Spencer said:
I have a Ferrari. I took the engine out of my Volkswagon and put it in the
Ferrari. Now the Ferrari doesn't run. Why doesn't my Ferrari run with a
Volkswagon engine?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.


This asp CODE does not work either. Only the HTML code is returned.

See Code below

_____________________________________________________________

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm5.aspx.vb"



Inherits="WebApplicationLPM.WebForm5"%>



<script language="VB" runat="server">



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here



Dim MyConnection As New
System.Data.SqlClient.SqlConnection("Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=pubs;Data
Source=CGLA;Trusted_Connection=yes")

Dim MyCommand As New System.Data.SqlClient.SqlCommand("select * from
Authors", MyConnection)



MyConnection.Open()



Dim dr As System.Data.SqlClient.SqlDataReader =
MyCommand.ExecuteReader()



MyDataGrid.DataSource = dr

MyDataGrid.DataBind()



MyConnection.Close()



End Sub



</script>

'____________________________________________________________________-


<HTML>



<body>

<h3><font face="Verdana">Simple Select to a DataGrid Control</font></h3>

<ASP:DataGrid id="MyDataGrid" runat="server" Width="700"
BackColor="#ccccff" BorderColor="black" ShowFooter="false" CellPadding="3"
CellSpacing="0" Font-Name="Verdana" Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd" EnableViewState="false" />

</body>



</HTML>

____________________________________________________________
 
G

Guest

This asp.net CODE does not work either. Only the HTML code is returned.

See Code below

_____________________________________________________________

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm5.aspx.vb"



Inherits="WebApplicationLPM.WebForm5"%>



<script language="VB" runat="server">



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Put user code to initialize the page here



Dim MyConnection As New
System.Data.SqlClient.SqlConnection("Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=pubs;Data
Source=CGLA;Trusted_Connection=yes")

Dim MyCommand As New System.Data.SqlClient.SqlCommand("select * from
Authors", MyConnection)



MyConnection.Open()



Dim dr As System.Data.SqlClient.SqlDataReader =
MyCommand.ExecuteReader()



MyDataGrid.DataSource = dr

MyDataGrid.DataBind()



MyConnection.Close()



End Sub



</script>

'____________________________________________________________________-


<HTML>



<body>

<h3><font face="Verdana">Simple Select to a DataGrid Control</font></h3>

<ASP:DataGrid id="MyDataGrid" runat="server" Width="700"
BackColor="#ccccff" BorderColor="black" ShowFooter="false" CellPadding="3"
CellSpacing="0" Font-Name="Verdana" Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd" EnableViewState="false" />

</body>



</HTML>

____________________________________________________________
 
K

Kevin Spencer

I saw it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
K

Kevin Spencer

This asp.net CODE does not work either. Only the HTML code is returned.

Does the page have a ".aspx" extension? Are you requesting it via HTTP? Is
ASP.Net registered on your machine?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top