我看了一下ie中的源代码,发现c#代码没有被解释成html,vs2003,framework,iis我都装了。

解决方案 »

  1.   

    C# is running in server 
      

  2.   

    我是在服务器中运行的,
    <script language="c#" runat="server">
    void Page_Load()
    {   
      time.Text=DateTime.Now.Hour.ToString() + ":" + 
                 DateTime.Now.Minute.ToString() + ":" +  
                 DateTime.Now.Second.ToString();

    </script><html>
    <head><title>The Punctual Web Server</title></head>
    <body>
      <h1>Welcome</h1>
      In WebServerLand the time is currently:
    <asp:label id="time" runat="server" />
    </body>
    </html>结果只有In WebServerLand the time is currently:
    没有时间出来
      

  3.   

    <script language="c#" runat="server">
    void Page_Load()
    {   
      time.Text=DateTime.Now.Hour.ToString() + ":" + 
                 DateTime.Now.Minute.ToString() + ":" +  
                 DateTime.Now.Second.ToString();

    </script><html>
    <head><title>The Punctual Web Server</title></head>
    <body>
    <FORM ID=FORM1 RUNAT=SERVER>
      <h1>Welcome</h1>
      In WebServerLand the time is currently:
    <asp:label id="time" runat="server" />
    </FORM>
    </body>
    </html>
      

  4.   

    不可能吧,你试着写一个简单的代码试一下,
    一个按钮,一个Label点击一下Label改变上面的文字,如果能运行就是其它的问题了
      

  5.   

    <%@ Import Namespace="System.Data" %>
    <%@ Page Language="C#" AutoEventWireup="True" %>
    <HTML>
    <script runat="server">
     
       ICollection CreateDataSource() 
       {
          DataTable dt = new DataTable();
          DataRow dr;
     
          dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
          dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
          dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
     
          for (int i = 0; i < 5; i++) 
          {
             dr = dt.NewRow();
     
             dr[0] = i;
             dr[1] = "Item " + i.ToString();
             dr[2] = 1.23 * (i+1);
     
             dt.Rows.Add(dr);
          }
     
          DataView dv = new DataView(dt);
          return dv;
       }
     
       void Page_Load(Object sender, EventArgs e) 
       {
     
          if (!IsPostBack) 
          {
             // Load this data only once.
             ItemsGrid.DataSource = CreateDataSource();
             ItemsGrid.DataBind();
          }
     
       }
     
       void Item_Bound(Object sender, DataGridItemEventArgs e) 
       {      ListItemType itemType = (ListItemType)e.Item.ItemType;      if ((itemType != ListItemType.Header) &&
              (itemType != ListItemType.Footer) &&
              (itemType != ListItemType.Separator))
          {         // Get the IntegerValue cell from the grid's column collection.
             TableCell intCell = (TableCell)e.Item.Controls[0];         // Add attributes to the cell.
             intCell.Attributes.Add("id", "intCell" + e.Item.ItemIndex.ToString());
             intCell.Attributes.Add("OnClick", 
                                    "Update_intCell" + 
                                    e.Item.ItemIndex.ToString() + 
                                    "()");         // Add attributes to the row.
             e.Item.Attributes.Add("id", "row" + e.Item.ItemIndex.ToString());
             e.Item.Attributes.Add("OnDblClick", 
                                    "Update_row" + 
                                    e.Item.ItemIndex.ToString() + 
                                    "()");
             
          }
     
       }
     
    </script>
    <script language="vbscript">   sub Update_intCell0 
          Alert "You Selected Cell 0."
       end sub   sub Update_intCell1 
          Alert "You Selected Cell 1."
       end sub   sub Update_intCell2 
          Alert "You Selected Cell 2."
       end sub   sub Update_intCell3 
          Alert "You Selected Cell 3."
       end sub   sub Update_intCell4 
          Alert "You Selected Cell 4."
       end sub   sub UpDate_row0 
          Alert "You selected the row 0."
       end sub   sub UpDate_row1 
          Alert "You selected the row 1."
       end sub   sub UpDate_row2 
          Alert "You selected the row 2."
       end sub   sub UpDate_row3 
          Alert "You selected the row 3."
       end sub   sub UpDate_row4 
          Alert "You selected the row 4."
       end sub    </script>
    <body>
    <form runat="server" ID="Form1">
    <h3>
    Adding Attributes to the &lt;td&gt; and &lt;tr&gt;
    <br>
    Tags of a DataGrid Control
    </h3>
    <asp:DataGrid id="ItemsGrid" runat="server" BorderColor="black" BorderWidth="1" CellPadding="3"
    ShowFooter="true" OnItemDataBound="Item_Bound" AutoGenerateColumns="false">
    <HeaderStyle BackColor="#00aaaa"></HeaderStyle>
    <FooterStyle BackColor="#00aaaa"></FooterStyle>
    <Columns>
    <asp:BoundColumn HeaderText="Number" DataField="IntegerValue">
    <ItemStyle BackColor="yellow"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn HeaderText="Item" DataField="StringValue" />
    <asp:BoundColumn HeaderText="Price" DataField="CurrencyValue" DataFormatString="{0:c}">
    <ItemStyle HorizontalAlign="right"></ItemStyle>
    </asp:BoundColumn>
    </Columns>
    </asp:DataGrid>
    <br>
    <br>
    Click on one of the cells in the <b>Number</b> column to select the cell.
    <br>
    <br>
    Double click on a row to select a row.
    </form>
    </body>
    </HTML>
    这个代码我试过应该可以的.
      

  6.   

    重新注册一下开始-运行-键入cmd并回车-进入:C:\WINNT\Microsoft.NET\Framework\v1.0.3705\(根据你的.net安装目录)-执行aspnet_regiis -i
      

  7.   

    aspnet_regiis这个命令说它不是内部命令,或可运行程序。
      

  8.   

    建议楼主:
    1.检查你安装的vs是否是正式的版本。
    2.如果是请分区--重装系统--重装vs。一般就会搞定了
      

  9.   

    应该是win2003的系统吧。你要打开IIS里支持ASP。NET的功能才行。
      

  10.   

    为什么ie中只能运行html代码,script中的c#代码运行不了???? 
    <script language="c#" runat="server">
    void Page_Load()
    {   
      time.Text=DateTime.Now.Hour.ToString() + ":" + 
                 DateTime.Now.Minute.ToString() + ":" +  
                 DateTime.Now.Second.ToString();

    </script><html>
    <head><title>The Punctual Web Server</title></head>
    <body>
      <h1>Welcome</h1>
      In WebServerLand the time is currently:
    <asp:label id="time" runat="server" />
    </body>
    </html>结果只有In WebServerLand the time is currently:
    没有时间出来
      

  11.   

    用VS新建一个WEBapplication项目,可以建不?还有,你是先装的IIS还是VS?
      

  12.   

    你看你站点配置里是否有.aspx和其他相关的应用程序映射!
    你的主要问题应该是在.net framework上
      

  13.   

    参考解决方法:
    1,检查你这段代码所处.aspx文件顶部是不是有一个类似这样的语句
    <%@ Page language="c#" Codebehind="Test.aspx.cs" AutoEventWireup="false" Inherits="MatchStudent.Test" %>
    把他删掉
      

  14.   

    我是先装iis的,
    站点配置里.aspx和其他相关的应用程序映射在哪里看
      

  15.   

    你打开的时候的地址是不是类似http://localhost/...或http://127.0.0.1/