VS 2008创建页面运行时报 编译器错误消息: CS0234 问题 本帖最后由 vitachuh 于 2011-02-20 15:55:42 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Inherits="DWL.BrowserStation.System.ErrorPage" 对应DWL.BrowserStation.System 下的 ErrorPage .cs VS 2008 新建 .NET 3.5 的 ASP.NET Web 应用程序后,直接运行,报 CS0234 错误。我发誓本来就有 System.Web 的引用。错误信息如下:[code=HTM]编译错误说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误消息: CS0234: 命名空间“DWL.BrowserStation.System”中不存在类型或命名空间名称“Web”(是否缺少程序集引用?)源错误: 行 13: 行 14: 行 15: public partial class ErrorPage : System.Web.SessionState.IRequiresSessionState {行 16: 行 17: protected System.Web.Profile.DefaultProfile Profile { 源文件: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\d29ed194\b0c2f01e\App_Web_errorpage.aspx.79613827.kdb-rwpp.0.cs 行: 15 [/code]另,新建页面时,自动生成如下代码,编译就报错,提示错误 1 命名空间“DWL.BrowserStation.System”中不存在类型或命名空间名称“Web”(是缺少程序集引用吗?) F:\Projects\CSharp\DWL\Applications\BrowserStation\System\ErrorPage.aspx.cs 16 45 BrowserStation public partial class ErrorPage : System.Web.UI.Page改成如下代码后,编译通过,运行报错 public partial class ErrorPage : Page还另,如下自动生成代码,运行也报错[code=HTM]<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ErrorPage.aspx.cs" Inherits="DWL.BrowserStation.System.ErrorPage" %>[/code]改成如下代码后,运行正常[code=HTM]<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ErrorPage.aspx.cs" Inherits="DWL.BrowserStation.System.ErrorPage" %>[/code]不知道是怎么回事,求解。附完整源码如下:ErrorPage.aspx.csusing System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;namespace DWL.BrowserStation.System{ public partial class ErrorPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }}ErrorPage.aspx[code=HTM]<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ErrorPage.aspx.cs" Inherits="DWL.BrowserStation.System.ErrorPage" %><!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> <center> <div style="font-family: Folkard; font-weight: bolder; font-size: 77px; padding-top: 30px;"> WELCOME<br /> TO<br /> USE<br /> DWL </div> </center></body></html>[/code] 新建WEB应用程序,检查相关引用 CodeFile在网站使用注意网站和应用程序 正则如何替换字符串 我装了2010,一启动老是提示这个,"Improve Microsoft Visual Studio performance" 存储过程作为repeater数据源绑定时,该如何写?急!!!! 以下C#代码什么意思?,特别是<T_CMS_Config>表示意思不懂 北京招聘asp.NET开发人员 C#.net中调试的问题???? 求GridView读取xml文件的源码 如何用SQL语句提取A.DBF表中的所有字段名 请问这个用户登陆程序哪里错了? 大家帮解决一个服务器控件难题,思归也帮忙看看,好吗? 这个问题要答好还是有点困难地... 为什么会经常出现死锁,怎么解决
[code=HTM]
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误消息: CS0234: 命名空间“DWL.BrowserStation.System”中不存在类型或命名空间名称“Web”(是否缺少程序集引用?)源错误:
行 13:
行 14:
行 15: public partial class ErrorPage : System.Web.SessionState.IRequiresSessionState {
行 16:
行 17: protected System.Web.Profile.DefaultProfile Profile { 源文件: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\d29ed194\b0c2f01e\App_Web_errorpage.aspx.79613827.kdb-rwpp.0.cs 行: 15
[/code]另,新建页面时,自动生成如下代码,编译就报错,提示错误 1 命名空间“DWL.BrowserStation.System”中不存在类型或命名空间名称“Web”(是缺少程序集引用吗?) F:\Projects\CSharp\DWL\Applications\BrowserStation\System\ErrorPage.aspx.cs 16 45 BrowserStation public partial class ErrorPage : System.Web.UI.Page
改成如下代码后,编译通过,运行报错 public partial class ErrorPage : Page
还另,如下自动生成代码,运行也报错
[code=HTM]
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ErrorPage.aspx.cs" Inherits="DWL.BrowserStation.System.ErrorPage" %>
[/code]改成如下代码后,运行正常
[code=HTM]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ErrorPage.aspx.cs" Inherits="DWL.BrowserStation.System.ErrorPage" %>
[/code]不知道是怎么回事,求解。附完整源码如下:ErrorPage.aspx.csusing System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;namespace DWL.BrowserStation.System
{
public partial class ErrorPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
}
}
ErrorPage.aspx
[code=HTM]
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ErrorPage.aspx.cs" Inherits="DWL.BrowserStation.System.ErrorPage" %><!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>
<center>
<div style="font-family: Folkard; font-weight: bolder; font-size: 77px; padding-top: 30px;">
WELCOME<br />
TO<br />
USE<br />
DWL
</div>
</center>
</body>
</html>
[/code]
注意网站和应用程序