My namespace disappear in ASP.NET 2(beta2)?

博客讲述了创建ASP.NET 2.0网页时,在代码隐藏的.cs文件添加命名空间后运行报错的问题。指出添加命名空间后,需将对应.aspx文件中页面继承的类名修改为包含命名空间的形式,修改后页面就能成功运行,还提及ASP.NET 1.1和2.0有诸多不同。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

   When you create your first ASP.NET 2.0 Web Page. You may say:"Oh!", there's no default namespace in your code-behind cs file? OK, let's add one, we think every object should be in one certain namespace. it's easy to add it, and then let's press F5 to run it. "What? Errors? I didn't do anything! just add a namespace!".
   OK, calm down, let me explain it. When you add a namspace to you aspx.cs file. please turn to the corresponding aspx file. look at this:
   <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
   You see, current page is inherited from the _Default, it should be changed to MyNamespace._Default, right? add it, and press F5, OK, you got it, you first page run successfully! Congratulation!
   There're so many different things between ASP.NET 1.1 and 2.0. I'm sure, and I'm a beginner. anyway, let's learn these things one by one.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值