我在app_code中写了一个Class1.cs文件:using System;/// <summary>
/// Class1 的摘要说明
/// </summary>
public class Class1
{
public Class1()
{
//
// TODO: 在此处添加构造函数逻辑
//
} public string P1
{
get
{
return "asdfa";
}
}}
无需编译,直接在页面中引用:<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim x As New Class1
Response.Write(x.P1)
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>然后直接运行,没有任何问题。
/// Class1 的摘要说明
/// </summary>
public class Class1
{
public Class1()
{
//
// TODO: 在此处添加构造函数逻辑
//
} public string P1
{
get
{
return "asdfa";
}
}}
无需编译,直接在页面中引用:<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim x As New Class1
Response.Write(x.P1)
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>然后直接运行,没有任何问题。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货