複製代碼 代碼如下:Function getCurrentUrl() On Error Resume Next Dim strTemp If LCase(Request.ServerVariables("HTTPS")) = "off" Then strTemp = "http://" Else strTemp = "https://" End If strTemp = strTemp & Request.ServerVariables("SERVER_NAME") If
複製代碼 代碼如下:'===================================== '獲得檔案尾碼 '===================================== Function Get_Filetxt(ByVal t0) Dim t1 IF Len(t0)<2 Or Instr(t0,".")=0 Then Get_Filetxt=False:Exit Function t1=Split(t0,".")
複製代碼 代碼如下:'===================================== '轉換內容,防止意外 '===================================== Function Content_Encode(ByVal t0) IF IsNull(t0) Or Len(t0)=0 Then Content_Encode="" Else Content_Encode=Replace(t0,"<","<")
複製代碼 代碼如下: <% Dim oConn, ors, aRows Dim i,j Set oConn=Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/newasp.resx") Set ors=oConn.Execute("Select TOP 5 SoftID,SoftName
程式健壯性最基本要求就是程式錯誤的處理與捕捉,在ASP.NET中,錯誤的處理有和其他程式設計語言一樣的機制,可以使用Try…Catch…Finally等方式,這一點和ASP相比具有較大的進步。而且,使用這些錯誤處理方法,可以大大提高程式的可讀性和程式調試速度,在這幾個優勢結合的情況下,我們更加應該注意這一點。 關於錯誤的處理,我們可以參考這篇文章: Try...Catch...Finally in ASP.NET Introduction
在asp.net2.0中的urlMappings倒是非常好用,可惜暫不支援Regex,不過,好在如果用IHttpModule的話 不管什麼樣的請求都會先經過IHttpModule這樣就為URL重寫提供了一個好機會: 下面是我寫的一個IHttpModule: using System; using System.Web; public class ReWriteModule:IHttpModule&
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;