asp.net 学习记录

1.关闭时提示“是否关闭”

Response.Write("<script language:javascript>javascript:window.close();</script>");

2.直接关闭不提示

Response.Write("<script language:javascript>javascript:window.opener=null;window.close();</script>");

 

=================================================================================================================

 

出现两次,第一次是Global


Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="OutputPathIssueExample.Global" Language="C#" %>

清理webconfig,去掉不必要的属性


第二次是新增加的一个页面

<%@ Page AutoEventWireup="true" Codebehind="CommentWindow.aspx.cs" Inherits="OrderVisionBackup.CommentWindow"  Language="C#" %>

Error    191    Could not load type 'OrderVisionBackup.CommentWindow'.    D:\xxx\xxx\CommentWindow.aspx    1   
改为

<%@ Page AutoEventWireup="true" CodeFile="CommentWindow.aspx.cs" Inherits="OrderVisionBackup.CommentWindow"     Language="C#" %>

 


--------------------------------------------------------------------------------


When you browse to an .aspx page, you may receive one of the following error messages:
Could not load type 'Namespace.Global'.
-or-
Could not load type 'Namespace.PageName'.
 
 有关这个Could not load type....查了资料有几种情况:

1. 编译成功发布后浏览页面报错,检查网站framework是不是合适


2. bin下是不是有 dll,bin文件夹位置对否。


3. 好吧我没看明白这种方法...  - =  http://support.microsoft.com/kb/306155


 Use one of the following methods to build the application:

Use the C# command line compiler (CSC.exe) to run the following command:
csc /t:library /r:System.web.dll /out:mydll.dll myfile.csIn Microsoft Visual Studio .NET, click Build on the Build menu
 4. 灰常有帮助的一篇!!

Visual Studio 2005 ‘Could Not Load Type Global.asax’ and ‘Cannot Copy Assembly After Build Because It Is Being Used By Another Process’ and ‘Control Name is not a member of Page Name’

Had a berserk time trying to load one of our corporate websites for the first time on a new DEV machine. It was an exemplary Journey Of Pain which I will now share with you.

The web site comprises 12 projects. Even after I loaded them down from Visual Source Safe into a solution and put in the necessary references to each other via Add Reference I still had a kaleidoscope of errors and warnings which no one here had ever seen before. My colleague performed a ‘Clean Solution’ which miraculously removed a lot of the warnings and errors.

Learning Point #1: When downloading a non-trivial solution from Visual Source Safe, do a Clean Solution after adding in all the references. There is some forum chat that says a Rebuild All will do the same thing, but I found in practice that Clean Solution cut out a lot of warnings and errors which Rebuild All did not.

I was now left with Cannot Load Type Global.asax.

Opening up the Global.asax.vb page I found some unresolved references, so I added those, then rebuilt, but still got Cannot Load Type Global.asax., A bit of Googling told me that Cannot Load Type Global.asax meant by main dll was not being generated. So I excluded Global.asax.vb from the project to see if anything was being covered up and did a rebuild.

That rebuild revealed a squillion errors. Specifically, I got a Cannot Load Type on every single one of the User Controls (ASCX files), plus cannot copy assembly after build because it is being used by another process . Googling the Cannot Copy Assembly After Builderror I found that this can occur because hostingEnvironment shadowCopyBinAssemblies=”false” was set in web.config. I commented out that entry and lucked out on it working. Cannot Copy Assembly After Build was deaded.

Next thing was to add references to 3rd party DLLs required by the solution. The DLLs were not in our Source Control so i had to hunt them up on the Web. these Dlls were referenced in our Web.Config file and not directly anywhere else, but they came out as obvious errors during the build.

This left me with 96 errors along the line of Cannot Load Type whatever.ascx along with a generous sprinkling of ‘ControlName’ is not a member of ‘PageName’.

Attribute Blocks

These turned out to be sourced from the same basic issue: the aspx.designer file was not being recognised by the Code Behind file – they were not linking together as if they did not belong to the same Partial Class. Unusually the designer files were not nested below the ascx file along with the aspx.vb (code behind file). I spent ages trying to force these designer files to regenerate without flat out deleting them or converting to a Web Application Project and then hit the post by hennehelene in this ASP.NET forum thread which prescribed a weird alchemy, namely to include a CodeFile attribute to the aspx.vb file, compile then remove the CodeFile Attribute and compile again.

HenneHelene’s solution works for me because my pages had the same basic markup as hers: A CodeBehind attribute, an Inheritsattribute, but no CodeFile attribute. I was thus able to add then remove the CodeFile attribute as described above, but I subsequently returned the CodeFile attribute back to the page because I didn’t want any future developer encountering the same issue.

The presence of the CodeBehind attribute without the CodeFileattribute suggests that the web site I was loading originally began life as a .NET 1.1 application

Codebehind is a .NET 1.1 Page Attribute which is retained in.NET 2.0 for backwards compatibility. CodeFile is the corresponding .NET 2.0 attribute.

 

关于 controls: http://msdn.microsoft.com/en-us/library/d19c0t4b.aspx


 ASP.NET Web Page Code Model: http://msdn.microsoft.com/en-us/library/015103yb.aspx

关于Inherits 注意namespace: OrderVisionBackup.CommentWindow

 

http://bbs.51js.com/archiver/tid-30542.html


Spring.net Could not load type from string value 
 出现 Could not load type from string value 的原因是 你配置的这个对象的 namespace 和你的应用程序 的namespace 不同。

  比如 应用程序 为 testSpringnet 而 对象的 namespace为 SpringExample ,则会出现以上错误

 必须注意 配置文件 配置的所有类型 要在 应用程序的 namespace 中

 

本文来自CSDN博客,转载请标明出处:http://www.cnblogs.com/neru/archive/2010/10/15/1851877.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: ASP.NET书城源码是一个基于ASP.NET框架开发的书城电子商务网站的源代码。它提供了一个完整的网上书店购书平台,用户可以注册账号、浏览图书、添加到购物车、进行付款和订单处理等操作。 该源码中的主要功能包括: 1. 用户注册和登录:用户可以注册账号并登录,以便于浏览和购买图书。 2. 图书分类和搜索:图书按照特定的分类进行组织,用户可以根据自己的需求进行分类浏览或者使用搜索功能找到想要的图书。 3. 图书详情和评论:用户可以查看每本图书的详细信息,包括作者、出版日期、图书简介等。同时,用户也可以在图书详情页面留下评论和评分,供其他用户参考。 4. 购物车和结算:用户可以把感兴趣的图书添加到购物车,并在结算页面中选择购买的图书数量和配送方式,生成订单进行付款。 5. 订单管理和物流追踪:用户可以查看自己的订单列表,了解订单的处理进程和物流状态。 6. 后台管理:管理员可以登录后台管理系统,对图书和订单进行管理,包括添加、删除和编辑图书信息,处理用户订单等操作。 ASP.NET书城源码可以作为学习ASP.NET开发的参考源码,其中包含了常见的电子商务网站的功能实现。开发者可以通过研究源码,了解ASP.NET框架的应用,掌握数据库设计和连接、前端和后端交互、用户身份验证等方面的知识。并且,可以根据实际情况进行二次开发,扩展和定制更适合自己业务需求的电子商务平台。 ### 回答2: ASP.NET书城源码是一个基于ASP.NET技术开发的网站,主要功能是实现书籍的展示、购买、评论、推荐等功能。 该书城源码具有以下几个主要特点: 首先,该网站的前端界面设计美观、简洁,符合现代用户的视觉需求。用户可以通过搜索栏、分类标签等方式快速找到自己想要的图书。 其次,该书城网站实现了购买图书的功能,用户可以通过添加图书到购物车,填写订单信息等方式实现购买图书的流程。同时,网站还提供了多种支付方式,例如支付宝、微信支付等,方便用户选择。 此外,该网站还包含了用户评论和评分功能,用户可以在购买并阅读完图书后对图书进行评价和打分,这些评价可以帮助其他用户了解图书的质量和内容,并作为购买的参考。 最后,该书城源码还实现了图书推荐功能,根据用户的浏览历史、购买记录等数据,系统可以智能推荐符合用户兴趣的图书,提高用户的购买体验。 总的来说,ASP.NET书城源码是一个功能齐全、界面美观的网站,可以为用户提供便捷的图书购买和浏览体验,是一个非常实用和有价值的项目。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值