原创 實現IHttpHandler接口來控制文件下載權限

今天碰到了一個很棘手的問題,由於原來從來沒做過這方面的考慮,所以一上來就把我搞蒙了,還好baidu,google了半天(連迅雷都用上了。。。)終於解決了這個問題。   如果你想控制某個.aspx頁面不讓未授權用戶訪問,那麼寫個web.co

原创 異步Ado.Net操作

 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;

原创 搜索框中輸入文本自動提示候選項代碼(像google那樣的)

 <textarea cols="50" rows="15" name="code" class="c-sharp"><%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD

原创 關於強名稱的使用來防止DLL被非法調用

 最近在想怎麼才能防止DLL非法調用的問題,想來想去也沒想到什麼好的方法。只想到了下面這麼一個方法,但是對一般的人來說還是管用的。平臺:WinXP sp3,Visual Studio 2008 Professional(CN)1)程序分爲

原创 .NET中的加密解密:私鑰加密(對稱加密):AES、DES、RC2、Rijindael、TripleDES

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Security.Cryptograph

原创 ListView:How to....

 內容:增加,編輯,刪除,排序,分頁。 <%@ Page Title="" Language="C#" MasterPageFile="~/Mail/MailMasterPage.master" AutoEventWireup="true

原创 使用FileUpload上傳文件時用js給出提示...

其實很簡單,主要是我沒怎麼好好看過js,所以還是想了一會兒才想出來。。。感覺這代碼有種騙人的感覺   <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx

原创 使用FileUpload控件上傳前預覽圖片

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="PreviewImageInFileUpload.aspx.cs" Inherits="PreviewImageInFile

原创 ClientScriptManager與ScriptManager向客戶端註冊腳本的區別

剛剛看了Jeffrey Zhao老師的Ajax課程,寫了個筆記,留着以後查找方便,如有不對地方,還請指正。 -----------------------------------------------------------------

原创 Visual Studio 2005 Windows Forms Controls List

    Visual Studio 2005 Windows Forms Controls List (part)   Category Control Name Remark Data Display DataGr

原创 Error:'Sys' is undefined.

關於這個錯誤,在網上找了10分鐘,發現90%的解決方案都是改寫Web.config。但我發現這解決方案有點不地道啊。 最後還是看了一個老外的說法才毛色頓開。看下面代碼就知道解決方案了。   <html xmlns="http://www.

原创 顯式接口實現(C# 編程指南)

 如果類實現兩個接口,並且這兩個接口包含具有相同簽名的成員,那麼在類中實現該成員將導致兩個接口都使用該成員作爲它們的實現。例如:interface IControl { void Paint(); } interface ISur

原创 委託與事件

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Sample_CUI { names

原创 .Net 中通用的FormatString格式符整理

  格式說明符 名稱 說明 d 短日期模式 顯示由與當前線程關聯的 DateTimeFormatInfo.ShortDatePattern 屬性定義的模式或者由指定格式提供程序定義的模式。 D 長日期模式

原创 一個自定義屬性(Attribute)的Demo

 using System; using System.Collections.Generic; using System.Text; using System.Reflection;//使用反射 namespace CUI.UseAt