3、aspx文件的服务器端脚本支持那些语言?
目前,aspx文件只支持c#、visual Basic.NET、Jscript.NET和J#,但是你使用code—behind(代码分离)的方法创建一个独立代码文件,你就可以使用任何.NET编译器支持的语言来实现功能了。
4、在global.asax文件中能使用code—behind(代码分离)技术吗?
当然可以了,例如:
Global.asax:
和使用code—behind(代码分离)技术
Global.asax:
MyApp.vb:
Imports System.Web
Imports System.Web.SessionState
Public Class MyApp
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("online_session"
= 0
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
Application("online_session"
= CInt(Application("online_session"
) + 1
Application.UnLock()
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Application.Lock()
Application("online_session"
10、Web控件是否支持样式表(CSS)呢?
yes. All Web controls inherit a property named CssClass from the base class System.Web.UI.WebControls.WebControl. The following example defines a CSS class named Input and uses it to modify a TextBox control to display text in red 10-point Verdana type:
支持,所有的web控件都从基类system.web.ui.webcontrols.webcontrol中继承了一个叫做cssclass的属性。
例如:
12、我是否可以自己创建服务器控件呢?
可以,创作您自己的 ASP.NET 服务器控件很容易。创建简单的自定义控件时,您所要做的只是定义从 System.Web.UI.Control 派生的类并重写它的 Render 方法。Render 方法采用 System.Web.UI.HtmlTextWriter 类型的参数。控件要发送到客户端的 HTML 作为字符串参数传递到 HtmlTextWriter 的 Write 方法。
例如:
服务器控件代码(简单显示字符串):Simple.vb:
Imports System
Imports System.Web
Imports System.Web.UI
namespace SimpleControlSamples
public Class SimpleVB : Inherits Control
protected Overrides Sub Render(Output As HtmlTextWriter)
Output.Write("欢迎使用控件开发!"