asp.net编译.dll:将ASP文件编译成DLL来源: 发布时间:星期四, 2009年2月12日 浏览:112次 评论:0
这篇文章主要是把ASP代码变成组件,开发者不仅是加快了ASP ![]() ![]() 下面,我们会来编写 ![]() ![]() ![]() ![]() 服务器端组件 首先,服务器端 ![]() ![]() ![]() ![]() ![]() ![]() 当IIS被请求执行 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 想不想你写 ![]() ![]() ![]() 系统和软件Software ![]() 你需要 ![]() ![]() ![]() ![]() ![]() ![]() 我们开始吧 启动你 ![]() ![]() ![]() ![]() ![]() ![]() 从中选择Microsoft Active Server Pages Object Library. 给工程和类命名 现在我们来根据自己 ![]() ![]() ![]() ![]() 如何改名,我就不想多说了! 我们 ![]() 怎样使用工程和类 现在我们有了我们自己 ![]() ![]() Set ObjReference = Server.CreateObject(\"ProjectName.ClassName\") 对于我们工程 ![]() Set ObjReference = Server.CreateObject(\"Example1.HelloWorld\") 现在我们就能用ObjReference来 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 〈% Set ObjReference = Server.CreateObject(\"Example1.HelloWorld\") ObjReference.SayHello %> 为了在Helloword类中使用ASP ![]() ![]() 子 ![]() Public Sub _disibledevent=>End Sub 现在,无论什么时候用户访问 ![]() ![]() ![]() ![]() ![]() ![]() Public Sub _disibledevent=>Set MyApplication = MyScriptingContext.Application Set MyRequest = MyScriptingContext.Request Set MyResponse = MyScriptingContext.Response Set MyServer = MyScriptingContext.Server Set MySession = MyScriptingContext.Session End Sub 以后我们就能用在VB中用MyApplication 来代替ASP中 ![]() %> 在VB中实现: MyTempVariable = MyRequest.Form(\"userName\") MyResponse.Write (\"you entered \"& MyTempVariable & \"as your user name\") 通过使用MyResponse来代替Response,我们能够使用所有Response ![]() 另 ![]() ![]() ![]() ![]() ![]() ![]() Public Sub _disibledevent=>Set MyApplication = Nothing Set MyRequest = Nothing Set MyResponse = Nothing Set MyServer = Nothing Set MySession = Nothing End Sub SayHello思路方法 我们来建立 ![]() ![]() ![]() ![]() ![]() 〈% Set ObjReference = Server.CreateObject(\"Example1.HelloWorld\") ObjReference.SayHello %> SayHello ![]() ![]() ![]() Public Sub SayHello ![]() MyResponse.Write (\"Hello World\") End Sub 现在 ![]() ![]() ![]() ![]() 注意,编译了此组件那么你就得先把你 ![]() 在ASP中使用我们 ![]() ![]() 当你更正了在编译中 ![]() ![]() ![]() ![]() 〈HTML> 〈HEAD> 〈TITLE>Example 1〈/TITLE> 〈/HEAD> 〈BODY> 〈% Set ObjReference = Server.CreateObject(\"Example1.HelloWorld\") ObjReference.SayHello %> 〈/BODY> 〈/HTML> 运行后即可看到结果: Hello World 注册组件 如果你想和你 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Regsvr32.exe C:/wwwroot/Example1/Example1.dll 在你 ![]() 我们这里只是写了 ![]() ![]() ![]() ![]() ![]() 0
相关文章读者评论发表评论 |