Time of Update: 2018-12-08
複製代碼 代碼如下:protected void Application_BeginRequest(Object sender, EventArgs e) { Application["StartTime"] = System.DateTime.Now; } protected void Application_EndRequest(Object sender, EventArgs e) { System.DateTime startTime =
Time of Update: 2018-12-08
部分代碼:複製代碼 代碼如下:using System; using System.Collections; using System.Collections.Specialized; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Data.Common; using System.Collections.Generic; namespace
Time of Update: 2018-12-08
複製代碼 代碼如下:private static char[] constant = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E',
Time of Update: 2018-12-08
1. 首先建立一個用於進行下載處理的page頁,如download.aspx,裡面什麼東西也沒有。 2. 添加一個DownloadHandler類,它繼承於IHttpHandler介面,可以用來自訂HTTP 處理常式同步處理HTTP的請求。 public class DownloadHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpResponse Response =
Time of Update: 2018-12-08
複製代碼 代碼如下:using System; using System.Collections.Generic; using System.Text; using Discuz.Common; using Discuz.Forum; using Discuz.Config; using Discuz.Entity; namespace DiscuzIntegration { public class Integration { public static void Login(string
Time of Update: 2018-12-08
你可以使用這個檔案實現應用程式安全性以及其它一些任務。下面讓我們詳細看一下如何在應用程式開發工作中使用這個檔案。概述Global.asax 位於應用程式根目錄下。雖然 Visual Studio .NET 會自動插入這個檔案到所有的 ASP.NET 項目中,但是它實際上是一個可選檔案。刪除它不會出問題——當然是在你沒有使用它的情況下。.asax 副檔名指出它是一個應用程式檔案,而不是一個使用 aspx 的 ASP.NET 檔案。Global.asax 檔案被配置為任何(通過 URL 的)直接
Time of Update: 2018-12-08
啥都不說了,直接奉獻原代碼 複製代碼 代碼如下:'==========注意=============================================== ' 1、網站所在檔案夾的名字不能為“root” ' 2、網站所在檔案夾的名字,實體路徑中不允許出現重複此檔案夾名,如F:\t\t,t為網站所在檔案夾名,這種情況會出錯 '============================================================= Dim dbPath,dbName,
Time of Update: 2018-12-08
檔案1:Deafault.aspx 複製代碼 代碼如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ outputcache duration="10" varybyparam="none" %> <!--設定緩衝時間為10秒--> <!DOCTYPE html PUBLIC "-//W3C//DTD
Time of Update: 2018-12-08
在這種配置下我們要實現關鍵詞不區分大小寫搜尋並高亮顯示要藉助ASP的正則處理了,請看下面代碼:複製代碼 代碼如下:<% Function Takeout(patrn,string1,colors) '提取搜尋索引鍵匹配文字 Dim regEx, Match, Matches, tt ' 建立變數。 Set regEx = New RegExp ' 建立Regex。 regEx.Pattern = patrn ' 設定模式。 regEx.IgnoreCase = True '
Time of Update: 2018-12-08
1、使用實值型別的ToString方法 在連接字串時,經常使用"+"號直接將數字添加到字串中。這種方法雖然簡單,也可以得到正確結果,但是由於涉及到不同的資料類型,數字需要通過裝箱操作轉化為參考型別才可以添加到字串中。但是裝箱操作對效能影響較大,因為在進行這類處理時,將在託管堆中分配一個新的對象,原有的值複製到新建立的對象中。 使用實值型別的ToString方法可以避免裝箱操作,從而提高應用程式效能。 int num=1; string str="go"+num.ToString(); 2
Time of Update: 2018-12-08
Default.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>test2</title> <script
Time of Update: 2018-12-08
1、web.config文檔<system.web>後面加入這一句: 複製代碼 代碼如下:<pages validaterequest="false"/> 樣本: XML/HTML 複製代碼 代碼如下:<?xml version="1.0" encoding="gb2312" ?> <configuration> <system.web> <pages validaterequest="false"/>
Time of Update: 2018-12-08
首先你要確定錯誤的原因: 讓IE顯示詳細的出錯資訊: 菜單--工具--Internet選項--進階--顯示友好的HTTP錯誤資訊,去掉這個選擇吧,對協助你確定錯誤所在非常有協助! 造成500錯誤常見原因有:ASP文法出錯、ACCESS資料庫連接語句出錯、檔案引用與包含路徑出錯、使用了伺服器不支援的組件如FSO等。注意資料庫的 一些釋放操作,是不是使用了set rs=nothing 而不是rs=nothing之類的問題
Time of Update: 2018-12-08
常見的處理方法是,在使用者登入時,判斷此使用者是否已經在Application中存在,如果存在就報錯,不存在的話就加到Application中(Application是所有Session共有的,整個web應用程式唯一的一個對象): 以下是引用片段: string strUserId = username.Text; ArrayList list = Application.Get("GLOBAL_USER_LIST") as ArrayList; if (list == null) {
Time of Update: 2018-12-08
<% '****************************** '函數:CheckChinese(strng) '參數:strng,待驗證字元 '描述:檢測是否為中文字元,傳回值:中文為true,否則false '樣本:<%=CheckChinese(strng)%> '****************************** Function CheckChinese(strng) CheckChinese = true Dim regEx, Match Set
Time of Update: 2018-12-08
文章目錄 ASP Session的功能的缺陷Web.config檔案簡介Web.config檔案中的Session配置資訊ASP.NET中用戶端Session狀態的儲存ASP.NET中伺服器端Session狀態的儲存將伺服器Session資訊儲存在進程中將伺服器Session資訊儲存在進程外將伺服器Session資訊儲存在SQL Server中
Time of Update: 2018-12-08
<%@ Import NameSpace="System.Net" %> <script language="C#" runat=server> protected void doClick(Object Src, EventArgs E){ IPHostEntry hostInfo = DNS.GetHostByAddr(txtIP.Text); showmsg.Text=hostInfo.Hostname; } </script>
Time of Update: 2018-12-08
using System; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Collections; namespace MyCorporation.DepartMent.DataBase { /// <summary> /// 通用資料庫類 /// </summary> public class DataBase { private
Time of Update: 2018-12-08
主要代碼如下: 複製代碼 代碼如下:public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/octet-stream"; HttpRequest req = context.Request; string filename = req.Url.AbsolutePath; string userid = string.Empty; if
Time of Update: 2018-12-08
這個問題困惑我好長的時間,在網上搜,也沒完全的解決方案,不是過於簡單,就是亂說,有的論壇上還沒人回答這個問題.今天我徹底解決這個問題,並在C#裡測試完全通過.現在把他寫出來,希望對朋友們有協助(如要轉載,記得給我著作權哦.嘿嘿!!!).以下資訊是綜合網上的資料和我的實際問題,整理出來的. 備份: 在備份按鈕裡寫: 複製代碼 代碼如下:protected void Button1_Click(object sender, EventArgs e) { string path =