Currently, ASP. NET can only run on Microsoft Windows 2000, Windows XP and Windows 2003 systems, and requires Microsoft Internet Information Server (IIS) support, Microsoft is scheduled to let Windows NT4.0 also supports ASP.net, but it is possible that Microsoft has some technical issues or market considerations and has not yet implemented NT's asp.net support.
2. Is it possible to use more than one language in an ASPX file?
The answer is a bit disappointing, although Microsoft offers a common language runtime (Clr,common laguage Runtime) that enables tight integration between multiple programming languages, allowing you to export the objects needed for C # from a VB object, but only one language in an ASPX file Just as you can't use C # 's syntax in vb.net.
3. The server-side script for ASPX files support those languages?
Currently, ASPX files only support C #, Visual Basic.NET, JScript.NET, and J #, but you use Code-behind (code-separated) method to create a stand-alone code file, you can use any. NET compiler to enable the functionality of the language.
4, in the Global.asax file can use Code-behind (code separation) technology?
Of course you can, for example:
Global.asax:
and using Code-behind (code separation) technology
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") = CInt (Application ("Online_session"))-1
Application.UnLock ()
End Sub
End Class
5. Can I see the code generated by the aspx file in asp.net?
As you can see, when your ASPX file contains commands or web.config in the declaration, you can microsoft.net\framework\v1.0.nnnn\temporary in the system directory asp.net Files that are generated by the aspx file in asp.net.
6, in the ASPX file how to annotate it?
Same as the methods in ASP files.
7. Can there be more than one server-side Form tag in the aspx file?
No
8. Can I use a custom data type in a Web form?
OK, you can put the DLL file containing the custom data type in the Bin directory under the program root directory, ASP. NET loads the DLL file when the data type is referenced.
9. Can I trigger those events in the Global.asax file?
The events that are triggered when the Application object is created and terminated are
application_start
application_end
The events that are triggered when the session object is created and ended are
Session_Start
Session_End
Events that are triggered when a request for a program occurs (in order of occurrence)
Application_BeginRequest
Application_AuthenticateRequest
Application_authorizerequest
Application_resolverequestcache
application_acquirerequeststate
Application_prerequesthandlerexecute
Application_postrequesthandlerexecute
application_releaserequeststate
Application_updaterequestcache
Application_EndRequest
An event that is triggered when a program has an error occurs
Application_Error
application_disposed
10. Does the Web control support style sheets (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-po int Verdana Type:
Support, all Web controls inherit a property called CssClass from the base class System.Web.UI.WebControls.WebControl.
For example:
11. Which namespaces are imported by default in ASPX files?
The ASPX default import namespace can be referenced directly and imported using other namespaces.
Default namespace
system
system.collections
system.collections.specialized
system.configuration
system.text
system.text.regularexpressions
system.web
system.web.caching
system.web.security
system.web.sessionstate
system.web.ui
system.web.ui.htmlcontrols
system.web.ui.webcontrols
12. Can I create my own server control?
You can, authoring your own ASP.net server control is easy. When you create a simple custom control, all you have to do is define a class derived from System.Web.UI.Control and override its Render method. The Render method takes parameters of the System.Web.UI.HtmlTextWriter type. The HTML that the control sends to the client is passed to the HtmlTextWriter Write method as a string parameter.
For example:
Server control code (simple display String): 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 ("<H2> Welcome to use control development!") </H2> ")
End Sub
End Class
End Namespace
Referencing file simple.aspx:
<%@ Register tagprefix= "simplecontrolsamples" namespace= "Simplecontrolsamples" assembly= "%>
Sending mail in a asp.net program no longer requires component support in the same way as an ASP, and the MailMessage and SmtpMail classes contained within the System.Web.Mail namespace of the. NET Framework base class can implement this functionality.
For example:
Dim message as New Mail.mailmessage
Message. from = "Web3@163.com"
Message. to = "Web3@163.com"
Message. Subject = "Test"
Message. BODY = "Content"
Mail.SmtpMail.SmtpServer = "localhost"
Mail.SmtpMail.Send (Message)
14. How will I read the picture in the database through ado.net and show it?
Here's an example of reading a picture from a pub database in Microsoft SQL Server and displaying it:
Here's an example of reading a picture from a pub database in Microsoft SQL Server and displaying it:
<%@ Import namespace= "System.Data.SqlClient"%>
<%@ Import namespace= "System.Drawing"%>
<%@ Import namespace= "System.Drawing.Imaging"%>
<%@ Import namespace= "System.IO"%>
<script language= "VB" runat= "Server" >
Sub Page_Load (Sender as Object, E as EventArgs)
Dim stream As New MemoryStream
Dim connection As SqlConnection
Connection=new SqlConnection ("server=localhost;database=pubs;uid=sa;pwd=")
Try
Connection. Open ()
Dim command As SqlCommand
Command = new SqlCommand ("Select logo from pub_info where pub_id= ' 0736 '", connection)
Dim image As Byte ()
Image = command. ExecuteScalar ()
Stream. Write (image, 0, image. Length)
Dim imgbitmap As Bitmap
Imgbitmap = new Bitmap (stream)
Response.ContentType = "Image/gif"
Imgbitmap. Save (Response.outputstream, Imageformat.gif)
Finally
Connection. Close ()
Stream. Clse ()
End Try
End Sub
</script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.