目前
答案讓你有點失望
目前
當然可以了
Global
和使用code—behind(代碼分離)技術
Global
MyApp
Imports System
Imports System
Public Class MyApp
Sub Application_Start(ByVal sender As Object
Application(
End Sub
Sub Session_Start(ByVal sender As Object
Application
Application(
Application
End Sub
Sub Session_End(ByVal sender As Object
Application
Application(
Application
End Sub
End Class
可以看到的
同ASP文件中的方法一樣
不可以
可以
Application對象創建和結束時所觸發的事件有
Application_Start
Application_End
Session對象創建和結束時所觸發的事件有
Session_Start
Session_End
對程序有請求發生時觸發的事件有 (按發生順序排列)
Application_BeginRequest
Application_AuthenticateRequest
Application_AuthorizeRequest
Application_ResolveRequestCache
Application_AcquireRequestState
Application_PreRequestHandlerExecute
Application_PostRequestHandlerExecute
Application_ReleaseRequestState
Application_UpdateRequestCache
Application_EndRequest
當有程序有錯誤發生時觸發的事件有
Application_Error
Application_Disposed
Yes
支持
例如
<html>
<head>
<style>
</style>
</head>
<body>
<form runat=
<asp:TextBox CssClass=
</form>
</body>
</html>
ASPX默認導入的名稱空間可以直接引用了
默認名稱空間
System
System
System
System
System
System
System
System
System
System
System
System
System
可以
例如
Imports System
Imports System
Imports System
Namespace SimpleControlSamples
Public Class SimpleVB : Inherits Control
Protected Overrides Sub Render(Output As HtmlTextWriter)
Output
End Sub
End Class
End Namespace
引用文件Simple
<%@ Register TagPrefix=
<html>
<body>
<form method=
<SimpleControlSamples:SimpleVB id=
</form>
</body>
</html>
在ASP
例如
Dim message As new Mail
message
message
message
message
Mail
Mail
下面舉一個從Microsoft SQL Server的PUB數據庫讀取圖片並顯示它的例子
<%@ Import Namespace=
<%@ Import Namespace=
<%@ Import Namespace=
<%@ Import Namespace=
<script language=
Sub Page_load(Sender as Object
dim stream as new MemoryStream
dim connection as SqlConnection
connection=new SqlConnection(
try
connection
dim command as SqlCommand
command = new SqlCommand (
dim image as byte()
image = command
stream
dim imgbitmap as bitmap
imgbitmap = new Bitmap (stream)
Response
imgbitmap
Finally
connection
stream
End Try
End Sub
</script>
From:http://tw.wingwit.com/Article/program/net/201311/15381.html